I've got a question regarding the attribute auto-retrieve="true" with a collection descriptor. I'm using the OTM Api.
Here is my situation, i have two class of persistent objects : CustomerGroup and Customer, the CustomerGroup has a collection that contains all the customers in the group. If i create and store a CustomerGroup and I immediately try to get the collection from my CustomerGroup i get a null pointer exception(auto-retreive="true" in my collection-descriptor). So i used PersistenceBroker.retrieveAllReferences() on my CustomerGroup before trying to load the collection and it works without a problem.
Is this a normal issue ? I though auto-retrieve="true" is used to retrieve the references automatically.
To test this i coded a simple main program, and what is weird is that i get the Null Pointer Exception only the first time i run the program, if i run it twice without cleaning the database i get no Exception.
here is a portion of my code :
....
custGroupMgr.addCustomerGroup("Test Group") ; <------- Stores a new Group to the DataBase
CustomerGroup custGroup = custGroupMgr.getCustGroupById(1) ; <----- Retrieves the Group from the DB
//PersistenceBrokerFactory pbFactory = new PersistenceBrokerFactory() ;
//PersistenceBroker pb = pbFactory.defaultPersistenceBroker();
//pb.retrieveAllReferences(custGroup) ;
System.out.println(custGroup.getCustomersInGroup().size()); <------ Null pointer Exception if leave comments
....
Thanks Jean-Francois Beaulac trainee programmer @ www.beetext.com
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
