I have the following code:
@PersistenceCapable(identityType = IdentityType.APPLICATION, detachable="true") public class A { @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) @PrimaryKey private Key key;
@Persistent
private B b;
@Persistent
private int id;
// ...
}
@PersistenceCapable(identityType = IdentityType.APPLICATION, detachable="true") public class B { @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) @PrimaryKey private Key key;
@Persistent
private int id;
// ...
}
Now what I need to be able to do, is retrieve an instance of B, and refer to it from an instance of A like this:
B b = DAL.getBById(1); A a = new A(); a.setB(b);
When I pass a to the makePersistent() method of the PersistenceManager, two things that I don't need happen:
1) a new instance of B is created 2) the reference A makes to b is null
Could someone tell me what I am doing wrong?
Thanks!