How to store complex objects? I have an object in its list of child objects in the child object has four list of child objects when calling makePersistent (person) object is not saved. Help!!!!!!!!!!!!
I am call pm.makePersistent(); but Lists
@Persistent
private List<ChoosedElementEntity> choosedElements = new ArrayList<ChoosedElementEntity>();
@Persistent
private List<PleasantElementEntity> pleasantElements = new ArrayList<PleasantElementEntity>();
@Persistent
private List<UnpleasantElementEntity> unpleasantElements = new ArrayList<UnpleasantElementEntity>();
@Persistent
private List<SetViewElementEntity> setViewElements = new ArrayList<SetViewElementEntity>();
not saved!!!
example:
@PersistenceCapable(table = "persons", identityType = IdentityType.APPLICATION)
public class PersonEntity {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Long id;
@Persistent
private List<OfferEntity> offers = new ArrayList<OfferEntity>();
}
@PersistenceCapable(table = "offers", identityType = IdentityType.APPLICATION)
public class OfferEntity {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key id;
@Persistent
private List<ChoosedElementEntity> choosedElements = new ArrayList<ChoosedElementEntity>();
@Persistent
private List<PleasantElementEntity> pleasantElements = new ArrayList<PleasantElementEntity>();
@Persistent
private List<UnpleasantElementEntity> unpleasantElements = new ArrayList<UnpleasantElementEntity>();
@Persistent
private List<SetViewElementEntity> setViewElements = new ArrayList<SetViewElementEntity>();
}
@PersistenceCapable(table = "offer_selections", identityType = IdentityType.APPLICATION)
public class ChoosedElementEntity {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key id;
@Persistent
private String code;
@Persistent
private Text cmComments;
}
@PersistenceCapable(table = "offer_selections", identityType = IdentityType.APPLICATION)
public class PleasantElementEntity {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key id;
@Persistent
private String code;
@Persistent
private Text cmComments;
}
@PersistenceCapable(table = "offer_selections", identityType = IdentityType.APPLICATION)
public class UnpleasantElementEntity {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key id;
@Persistent
private String code;
@Persistent
private Text cmComments;
}