Hi,
I have written a method named updateDatabase() in a STATELESS SESSION BEAN where i am 
doing various database insertions and updations using my ENTITY BEANs (using CMP). 
i've put the parent insertion first and then child insertion as we should do.
when i'm executing the updateDatabase(), some times its getting executed successfully 
and sometimes its not saying that parent record not found. The exact exception is :

************************************************************************
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]INSERT 
statement conflicted with TABLE FOREIGN KEY constraint 
'FK_CIR_ILL_SERVE_BUDGET_ACC_BUDGET_TRANSACTION1'. The conflict occurred in database 
'pubs', table 'ACC_BUDGET_TRANSACTION'.
 at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
 at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
************************************************************************

What i observed during successful execution of updateDatabase() was: the ejb container 
is inserting record in parent table first and then in child. And it fails execution of 
the same method, when the container is trying to insert the record in child table 
first and then in parent. what i mean to say is the ejb container is not performing 
the insert or update operations on database in the order I have given,  but in its own 
order, some times it was correct and some time was wrong.

I don't understand why EJB container was trying to insert record in parent table first 
and then in child table.

Even though i tried to put parent insertions in a seperate method from child 
insertions and given REQUIRED transaction attribute for parent insertion method and 
MANDATORY for child insertion method i have not found any difference.
how to make the container to execute all the ejbCraete() statements of EBs in the 
order i have given.

I am using CONTAINER MANAGED PESISTANCE & TRANSACTIONs and i want to go in the same 
way.

Please suggest me a solution.

Thank you

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to