I'm trying to both wrap my head around Cornerstone and fill a need by creating an Open Source voting application and a portlet to go with it. I've set up my database and a simple test app based on DemoPersistence.java. The db has no users and I tried to createInstance(new Integer(101)), thinking it would create a new record in the db. Apparently retrieveAndPopulate, which createInstance calls, just returns null if the query returns and empty recordset. After doing walkabout in the code I discovered the following inheritance tree:
BasePersistentObjectFactory
which extends BasePersistenceFactory (implements IPersistenceFactory),
which extends InversionOfControlFactory,
which extends BaseFactory


Seeing that store(Object) in BasePersistentObjectFactory first calls createInstance(), I tracked createInstance() to the IoC factory.
To make a long story short, and sum up the behavior:
a. createInstance(param) - retreives the instance data from the database
b. createInstance() - creates a fresh new instance
c. inst = createInstance(), set properties, store(inst) create a fresh new instance and stores it in the db


This may be old hat for many folks, but for anyone trying to get a handle on creating their own persistent object this may be useful.

Bill Barnhill



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to