Bugs item #658224, was opened at 2002-12-24 15:03
Message generated for change (Settings changed) made by ejort
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=658224&group_id=22866

Category: JBossCX
Group: v3.0 Rabbit Hole
>Status: Closed
>Resolution: Out of Date
Priority: 5
Submitted By: David Jencks (d_jencks)
Assigned to: David Jencks (d_jencks)
Summary: ut.rollback may not work after sqlexcept

Initial Comment:
Problem found with jboss 3.0.2, following code snippet may not 

result in actual rollback even if ut.rollback called.  Reordering code 

to close connection in finally block before commit/rollback 

reported to fix the problem.  See forum thread http://

www.jboss.org/forums/thread.jsp?forum=136&thread=26437



public RuleVO insert(RuleVO rule) {

UserTransaction ut = context.getUserTransaction();



DAOFactory daoFactory = DAOFactory.getDAOFactory();

Connection conn = null;



RuleVO savedRule = new RuleVO();

try {

ut.begin();

try {

conn = daoFactory.getConnection();

} catch (IllegalArgumentException ex) {

throw new EJBException(

"Could not establish database connection: " + ex.getMessage());

}

savedRule = daoFactory.getRuleDAO().insert(conn, rule);

ut.commit();

} catch (SQLException e) {

try {

ut.rollback();

} catch (SystemException syex) {

throw new EJBException

("Rule insert & rollback failed: " + syex.getMessage());

}

throw new EJBException

("Rule insert failed: " + e.getMessage());

} catch (Exception ex) {

throw new EJBException

("Rule insert begin/commit transaction failed: " + 

ex.getMessage());

} finally {

try {

DAOFactory.closeConnection(conn);

} catch (SQLException ex) {

throw new EJBException(

"Could not close database connection: " + ex.getMessage());

}

return savedRule;

}

}



----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=658224&group_id=22866


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
JBoss-Development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to