You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by John Armstrong <si...@gmail.com> on 2008/12/30 17:02:37 UTC

Pre-persist not firing

This is really basic but I am a bit sick and am just not finding my
answer (thats my excuse, sick..)

In my map I have this (generated via M5 Modeler):

       <obj-entity name="Company" className="com.printgate.model.Company"
dbEntityName="COMPANY">
               <obj-attribute name="companyid" type="java.lang.String"
db-attribute-path="COMPANYID"/>
               <obj-attribute name="isactive" type="boolean"
db-attribute-path="ISACTIVE"/>
               <pre-persist method-name="generateCompanyID"/>
       </obj-entity>

In my com.printgate.model.Company object I have this method:

       public void generateCompanyID(){
               System.out.println("In generate");
       }

I call it like this :

       public BigTest(){
               context = DataContext.createDataContext();
               theCompany = (Company)
context.newObject(com.printgate.model.Company.class);
               context.commitChanges();
       }

The object is created in the datastore but my pre-persist never fires.

This is M5. I also rolled back to M4 with the same problem so I am
sure its something obvious that i am missing in how I wire it all
together (although it does work in another project I have).

Thanks
John-