> In Mysql it is possible to have associations between different databases (schemas)
Databases and Schemas are very different things. I now get the impression you are talking about tables in the same database but in different schemas (which should work fine).
> But, as Rob said, in Ebean is not possible.
Careful. I was referring to Databases - NOT Schemas.
We absolutely should be able to have associations between tables that are in the same database but in different schemas. There should be no problem doing that (assuming the appropriate database permissions are granted) !!!
Cheers, Rob.
@Override
public void save() {
identityDocument.save();
DB.save(this);
}
public static User byId(Integer id) {
User user = find.query().select("username, identityDocument.identityDocumentId").where().eq("userId", id).findOne();
user.identityDocument = IdentityDocument.getById(user.identityDocument.identityDocumentId);
return user;
}
With this it is possible to do
IdentityDocument idDoc = new IdentityDocument("Markus", "AABBCC123", "25/07/2025");
user.identityDocument = idDoc;
user.save();
With the rest of the associations (OneToMany, ManyToOne and ManyToMany), I believe that it is not possible to do this like this and the only solution may be the one provided by Jens (without foreign keys and storing only an identifier instead of an object).
I don't know if you think of anything better.