Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Entity EJB & data integrity problem  RSS feed

 
Laurent Raynal
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Here is yet another ejbStore() call problem :
I have a CMP entity bean mapping a table. In my program it is created from a "wrapper" Session Bean that encapsulates data access. The session bean method has a TRANSACTION_READ_COMMITTED isolation setting. Then the method
goes on to create a related record
in another table that has a foreign key constraint to the "Entity" table,
using other classes (the Data Access Object Pattern).
The method fails throwing an SQLException saying the foreign key constraint is violated : in fact the Entity ejbStore() method is never called.
Actually, all my EJB methods (for session and entity beans) have a
TRANSACTION_READ_COMMITTED isolation setting because I previously ran into
an Oracle Serialization problem (the well-known ORA-08177 widely discussed
in other forums).
Generally, we use DAO classes to perform all "dependent" tables management,
the main table being mapped to an entity bean.
What transaction setting or strategy should I use to make this work ?
I'm using Weblo 5.1 SP 11 on NT
Thanks in advance.
 
Karl Laird
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can see two potential areas causing this problem.
As the container is free to cache database updates for performance, by using a method other than through the container to access a newly created instance maybe the underlying DB has not yet been updated. This could be from either the ejbStore() or ejbCreate() methods.
Also as 'The entity bean provider should use the ejbStore() method to update the instance using the accessor methods before its persistant state is synchronised.' (EJB specification) perhaps your server has taken this part of the contract to mean that you should be calling the ejbStore() method to synchronise rather than relying on its having done so.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!