These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: problem with transaction handling
PostPosted: Sat Jan 08, 2005 6:47 am 
Newbie

Joined: Sat Jan 08, 2005 6:29 am
Posts: 2
hello all,
whenevr i try to delete any instance from memory then first of all the following exception is thrown but after that the instance also gets removed.Can anyone help me in resolving this issue.Any help is highly appreciated.

Hibernate version:
2.0
Mapping documents:

My Hibernate.cfg.xml file:-
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration
PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">

<hibernate-configuration>
<session-factory >
<property name="hibernate.connection.url">
jdbc:mysql://localhost:3306/vergil
</property>
<property name="connection.datasource">orchestration-client-Pool</property>
<property name="hibernate.jndi.url">t3://vaibhav:7001</property>
<property name="hibernate.jndi.class">weblogic.jndi.WLInitialContextFactory</property>
<property name="dialect">net.sf.hibernate.dialect.SQLServerDialect</property>
<property name="hibernate.use_outer_join">true</property>
<property name="jta.UserTransaction">java:comp/UserTransaction</property>
<property name="hibernate.show_sql">true</property>
<mapping resource="ProcessLogs.hbm" />
<mapping resource="ProcessInstances.hbm" />
<mapping resource="ServiceInstances.hbm" />
<mapping resource="ProcessModels.hbm" />
<mapping resource="PmUser.hbm" />
<mapping resource="PmGroupUser.hbm" />
<mapping resource="ServiceRoles.hbm" />
<mapping resource="SystemServices.hbm" />
<mapping resource="ProcessServices.hbm" />
<mapping resource="PmGroup.hbm" />
</session-factory>
</hibernate-configuration>


Code between sessionFactory.openSession() and session.close():

public void delete(Object obj) throws HibernateException {
Transaction t = null;
UserTransaction ut =null;
Session s = null;
try {
s = getSession();
t = s.beginTransaction();
delete(obj, s);
t.commit();
}
catch (HibernateException e) {
if (null != t) t.rollback();
throw e;
}
finally {
closeSession(s);
}
}

Full stack trace of any exception that occurs:

java.sql.SQLException: Cannot call Connection.commit in distributed transaction. Transaction Manager will commit the resource manager when the distributed transaction is committed.

at weblogic.jdbc.wrapper.JTSConnection.commit(JTSConnection.java:509)
at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:63)
at com.wos.hibernate.util.base._BaseRootDAO.delete(_BaseRootDAO.java:519)
at com.wos.hibernate.util.base.BaseProcessModelsDAO.delete(BaseProcessModelsDAO.java:107)
at com.wos.dao.AdminDAO.deleteProcessModels(AdminDAO.java:2680)
at com.wos.bean.AdminBean.deleteProcessModels(AdminBean.java:444)
at com.wos.bean.WOSAdmin_whklez_EOImpl.deleteProcessModels(WOSAdmin_whklez_EOImpl.java:694)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.java:383)
at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:291)
at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:330)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:71)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:150)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:120)
at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:475)
at org.apache.axis.server.AxisServer.invoke(AxisServer.java:323)
at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:854)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:339)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1053)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:387)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:305)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6310)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3622)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2569)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
Name and version of the database you are using:

MYSQL 3.52

The generated SQL (show_sql=true):

Hibernate: select processmod0_.PM_ID as x0_0_, processmod0_.PM_NAME as x1_0_, processmod0_.PM_DESC as x2_0_, processmod0_.PM_STATUS as x3_0_, processmod0_.PM_VERSION as x4_0_, processmod0_.PM_CREATED_BY as x5_0_, processmod0_.PM_CREATED_DATE as x6_0_, processmod0_.PM_MODIFIED_BY as x7_0_, processmod0_.PM_MODIFIED_DATE as x8_0_ from process_models processmod0_ where (processmod0_.PM_CREATED_BY='admin' )
Hibernate: select processmod0_.PM_ID as PM_ID0_, processmod0_.PM_VERSION as PM_VERSION0_, processmod0_.pm_group_permissions as pm_group3_0_, processmod0_.PM_MODIFIED_BY as PM_MODIF4_0_, processmod0_.PM_DESC as PM_DESC0_, processmod0_.PM_DATA as PM_DATA0_, processmod0_.pm_other_permissions as pm_other7_0_, processmod0_.PM_DOCUMENT as PM_DOCUM8_0_, processmod0_.PM_CREATED_DATE as PM_CREAT9_0_, processmod0_.PM_STATUS as PM_STATUS0_, processmod0_.PM_BPEL as PM_BPEL0_, processmod0_.PM_MODIFIED_DATE as PM_MODI12_0_, processmo
d0_.PM_CREATED_BY as PM_CREA13_0_, processmod0_.EXTERNAL_ID as EXTERNA14_0_, processmod0_.PM_NAME as PM_NAME0_ from process_models processmod0_ where processmod0_.PM_ID=? and processmod0_.PM_VERSION=?
Hibernate: delete from process_models where PM_ID=? and PM_VERSION=?

Debug level Hibernate log excerpt:

_________________
Vaibhav


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 08, 2005 7:42 am 
Expert
Expert

Joined: Fri Nov 07, 2003 4:24 am
Posts: 315
Location: Cape Town, South Africa
Are you operating in the context of an EJB that provides container managed transactions?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 09, 2005 5:34 pm 
Expert
Expert

Joined: Fri Nov 07, 2003 4:24 am
Posts: 315
Location: Cape Town, South Africa
Use the hibernate transaction API:
http://www.hibernate.org/245.html


Top
 Profile  
 
 Post subject: thanks!!!
PostPosted: Mon Jan 10, 2005 1:32 am 
Newbie

Joined: Sat Jan 08, 2005 6:29 am
Posts: 2
drj wrote:
Use the hibernate transaction API:
http://www.hibernate.org/245.html


thanks alot for advice issue resolved.it was using jdbc transc. factory instead of jta

_________________
Vaibhav


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.