Question

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) { .. }
}
Was it helpful?

Solution

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)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top