1

I have a data object, AssetDO, in the database table FOO.DBO.ASSET. Asset has a column for userId, which refers to a table in a different database, BAR.DBO.USER.

Is it possible to write a JDOQL query that supports UserDO (the user objecT) being referenced from the AssetDO class, rather than just including an id and me doing the lookup later?

I want:

public class AssetDO {
    private User user;
    public User getUser() { .. }
    public void setUser(User user) { .. }
}

instead of:

public class AssetDO {
    private long userId;
    public long getUserId() { .. }
    public void setUserId(long userId) { .. }
}
Eric Stein
  • 13,209
  • 3
  • 37
  • 52
  • JDOQL allows reference to any field that has its persistence defined in the current PMF. JDO allows catalog and schema to be specified for any class. No idea what "embedded" (where an object is persisted into the table of another object) has to do with this. – DataNucleus Jan 19 '14 at 08:36
  • Sorry, I was using "embedded" in a non-technical manner. I edited and correct that. Using catalog absolutely worked for me, thanks! If you choose to fashion a reply, I will upvote and mark correct. – Eric Stein Jan 21 '14 at 12:13

1 Answers1

1

JDOQL allows reference to any field that has its persistence defined in the current PMF. JDO allows catalog and schema to be specified for any class, so consequently you can select across catalogs/schemas just like you can in an RDBMS (as long as the two databases are in the same server)

DataNucleus
  • 15,497
  • 3
  • 32
  • 37