Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Transactions

 
Sujit Nene
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
In my ejb project i have used container managed transactions. I am using weblogic as ejb container. But i have found that transactions are not taking place. I am firing multiple sql queries on different tables in one of method of a session bean. It does not rollback even if one of the queries fail.
Can anybody tell what may be the cause of this?
with regards,
Sujit
 
John Bateman
Ranch Hand
Posts: 320
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
What does your deployment descriptor look like for that session bean?

 
Steve Chernyak
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you using a DataSource for your querry?
I think you might hava to setup TxDataSource and use it for stuff that needs to be a part of transactions
 
Sujit Nene
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by John Bateman:
Hi
What does your deployment descriptor look like for that session bean?

Hi John,
This is how my deployment descriptor looks like. I have a session bean TestDoneManager. I am firing multiple sql queries in its 'addTestDone' method and creating 'Bug'.
<?xml version="1.0"?>
< !DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN' 'http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd'>
< ejb-jar >
< enterprise-beans >
< session >
< ejb-name>ATP.TestDoneManager< /ejb-name>
< home >com.seipl.atp.services.TestDoneManagerHome< /home>
< remote >com.seipl.atp.services.TestDoneManager< /remote >
< ejb-class>com.seipl.atp.services.TestDoneManagerEJB< /ejb-class >
< session-type >Stateful< /session-type >
<transaction-type >Container< /transaction-type >
< ejb-ref >
< ejb-ref-name >ATP.Bug< /ejb-ref-name >
< ejb-ref-type >Entity< /ejb-ref-type >
< home >com.seipl.atp.entity.beans.BugHome< /home >
< remote >com.seipl.atp.entity.beans.Bug< /remote >
< /ejb-ref >
< resource-ref >
< res-ref-name >ATP-Data-Source< /res-ref-name >
< res-type >javax.sql.DataSource< /res-type >
< res-auth >Container< /res-auth >
< /resource-ref >
< /session >
< /enterprise-beans >

< assembly-descriptor >
< container-transaction >
< method >
< ejb-name >ATP.TestDoneManager< /ejb-name >
< method-name >addTestDone< /method-name >
< /method >
< trans-attribute >RequiresNew< /trans-attribute >
< /container-transaction >
< /assembly-descriptor >
< /ejb-jar >
- Sujit
[This message has been edited by Sujit Nene (edited June 15, 2001).]
 
Sujit Nene
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Steve Chernyak:
Are you using a DataSource for your querry?
I think you might hava to setup TxDataSource and use it for stuff that needs to be a part of transactions

Hi Steve,
I am using a data source. It is not a TxDataSource. I went through documentation provided by weblogic. As my transactions span local database i do not need TxDataSource as they are primarily used for distributed transactions.
- Sujit
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic