I am using the local version of the JDO implementation for App Engine. When I request an object that contains other objects as inline fields, inline fields are returned as null.
For example, let's say that this is the main object that I save:
@PersistenceCapable
public class Branch {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Long id;
@Persistent
private String name;
@Persistent
private Address address;
...
}
and this my embedded object:
@PersistenceCapable(embeddedOnly="true")
public class Address {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Long id;
@Persistent
private String street;
@Persistent
private String city;
...
}
The following code does not retrieve the embedded object:
PersistenceManager pm = MyPersistenceManagerFactory.get().getPersistenceManager();
Branch branch = null;
try {
branch = pm.getObjectById(Branch.class, branchId);
}
catch (JDOObjectNotFoundException onfe) {
}
catch (Exception e) {
}
finally {
pm.close();
}
Does anyone have a solution for this? How can I get a Branch object with my subaddress?
source
share