Re: Issues in calling DAO from Sateless session bean

Ihar Makushynski <[email protected]> Thu, 16 Dec 2004 14:39:11 +0200
Newsgroups gmane.comp.java.sun.ejb.general
Message-ID <[email protected]>
Check transaction attribute from this method in ejb-jar.xml.

It should be "Required", "RequiresNew" or "Mandatory" depends on your
business logic. 

Best Regards,
Ihar Makushynski



________________________________

From: A mailing list for Enterprise JavaBeans development
[mailto:[email protected]] On Behalf Of Suresh Babu Koya
Sent: Thursday, December 16, 2004 2:37 PM
To: [email protected]
Subject: [EJB-INT] Issues in calling DAO from Sateless session bean

 

I have a stateless session bean which uses container managed
transactions. I had to call

a DAO in which I insert two records, from the session bean. If there is
an exception while inserting 

second record in the DAO, I am facing the problem that the first record
is already commited

inspite of throwing the Exception.

 

I was able to have a workaround by calling setRollbackonly on the
transaction context. I am not sure

why this should be done. If the transactions are managed by container
and I am not calling commit

explicitly why should I call setRollbackonly.

 

Does anyone have any idea why this works this way?

 

Regards,

Koya Suresh 

    

 

========================================================================
=== 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". 


===========================================================================
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".