Hi i'm having a problem with ejb2.0 entity beans ( i'm currently running on j2ee ri v1.3 ). the problem is this i've created a very simple entity bean just 4 fields, the deploy tool works fine and the bean deploy's correcly. the table related to this bean is created correctly. i have then constructed a simple client and created an instance of the bean which also works correctly, there are no error's on the back end, and no errors in the db logs. now here's the bit that's driving me mad, the data is never written to the database. i can find the bean again by using findByPrimaryKey and it reterives the bean instance correctly i can modify the data held by the bean, but if i shut down the j2ee and restart it the bean is lost. any help on this would be greatly appricated regards
Ingi Gauti
Greenhorn
Joined: May 24, 2001
Posts: 4
posted
0
For those who are interested in the answer, I didn't do the setEntityContext and unsetEntityContext methods, it should be like this public void setEntityContext(EntityContext ctx) { ejbContext = ctx; } public void unsetEntityContext() { ejbContext = null; }
Originally posted by Ingi Gauti: For those who are interested in the answer, I didn't do the setEntityContext and unsetEntityContext methods, it should be like this public void setEntityContext(EntityContext ctx) { ejbContext = ctx; } public void unsetEntityContext() { ejbContext = null; }
You require this, since EntityContext allows your Beans to know about the environment. - Sandeep
<b>Sandeep</b> <br /> <br /><b>Sun Certified Programmer for Java 2 Platform</b><br /> <br /><b>Oracle Certified Solution Developer - JDeveloper</b><br /><b>-- Oracle JDeveloper Rel. 3.0 - Develop Database Applications with Java </b><br /><b>-- Object-Oriented Analysis and Design with UML</b><br /> <br /><b>Oracle Certified Enterprise Developer - Oracle Internet Platform</b><br /><b>-- Enterprise Connectivity with J2EE </b><br /><b>-- Enterprise Development on the Oracle Internet Platform </b>
I am facing the same problem. I have put in the setEntityContext and unsetEntityContext methods, as suggested in the previous post. However, the problem still persists.
Hi, data will be written into database, when the server invokes the ejbStore Method. This method is called after commiting the transaction. Make sure that the appropriate methods do have the 'REQUIRED' property for transaction at least.
------------------ Marco Barenkamp ____________________________________________ L M I N T E R N E T S E R V I C E S AG Senior Trainer & Architect, BEA Certified Enterprise Developer Sun Certified Programmer for the Java2 Platform Sun Certified Web Component Developer for the Java2 Platform Sun Certified Developer for the Java 2 Platform Sun Certified Enterprise Architect for the Java 2 Platform Enterprise Edition (PI)
Marco Barenkamp<br />_ _ _ _ _ ________________________ _ _ _ _ _ <br />L M I N T E R N E T S E R V I C E S AG<br /> <br />Head of Software Development<br /> <br /> <br />BEA Certified Enterprise Developer<br />Sun Certified Programmer for the Java2 Platform<br />Sun Certified Web Component Developer for the Java2 Platform<br />Sun Certified Developer for the Java 2 Platform <br />Sun Certified Business Component Developer for the Java 2 Platform <br />Sun Certified Enterprise Architect for the Java 2 Platform Enterprise Edition<br /> <br />LMIS AG