Ok very interesting I have found the problem and maybe for your
interest: The corresponding
Model values are empty when accessed via the public member:
DOESN'T WORK:
Player p = new Player();
p.clan = new Clan("MyTest");
Ebean.save(p); //to this point it works perfectly. Saving into DB is
fine.
...
Player p2 = Ebean.find(Player.class, 1); //Assuming ID 1 was generated
with the save operation
System.out.println(
p2.clan.name); //Is empty. (actually it somehow
crashes Play! framework and my browser looses connection to the
server, but p2.clan is not null its just an empty Clan object as far
as I could find out)
WORKS:
Player p2 = Ebean.find(Player.class, 1);
System.out.println(p2.getClan().getName());
When the member are private and correctly wrapped in getter-setter
calls the String is correctly read from the database. (if I subclass
my models from play.db.ebean.Model or not
makes no difference by the way, it stays or falls with using accessor
methods.
I am glad it works and I anyway like the usage of accessors more then
plain public members. But out of curiosity is this behaviour intended?
Sorry if I annoyed someone with my newbie like questions and many
thanks for the nice answers!
Thomas