-->
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.  [ 6 posts ] 
Author Message
 Post subject: unchained transaction mode error for a named query call.
PostPosted: Mon Sep 19, 2005 1:52 pm 
Newbie

Joined: Mon Sep 19, 2005 12:52 pm
Posts: 4
I am using Sybase 11 with Hibernate 3.05 and receive the following error when I try to execute the following code using a named query.

try
{
Session session = HibernateUtilSimple.currentSession();

List acctStatusList = session.getNamedQuery("getAccountStatus").list();
logger.info("Size of List is : " + acctStatusList.size());
HibernateUtilSimple.closeSession();
}


<hibernate-mapping package="com.ssmb.esales.account.model" auto-import="true" default-lazy="false">
<class name="AccountStatusSummary">
<id name="accountId" column="AccountId"></id>
</class>

<!-- Here's A Sample Of How to Declare the Stored Procedure -->
<sql-query name="getAccountStatus" callable="true">
<return alias="" class="AccountStatusSummary">
<return-property name="accountId" column="ActI"/>
<return-property name="accountMnc" column="ActMnc"/>
<return-property name="cpiNum" column="CpiNum"/>
<return-property name="currentStatusCode" column="CurrentStatusCode"/>
<return-property name="gfcId" column="Gfcid"/>
<return-property name="imsNum" column="ActIMSNum"/>
<return-property name="legalEntityName" column="ActDesc"/>
</return>

{ ? = call getGfcidRequestTb("CurrentStatusCode","Not Acknowledged") }
</sql-query>
</hibernate-mapping>


2005-09-19 12:40:54,825 ERROR [org.hibernate.util.JDBCExceptionReporter] - <Stored procedure 'getGfcidRequestTb' may be run only in unchained transaction mode. The 'SET CHAINED OFF' command will cause the current session to use unchained transaction mode.

What do I need to do to fix this ?

Thanks
David


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 19, 2005 2:10 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
i used google and found an answer in seconds....why dont you try the same ?

hint: the error is sybase specific and has to do with the default mode sybase runs stored procedures and transactions in.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 19, 2005 3:59 pm 
Newbie

Joined: Mon Sep 19, 2005 12:52 pm
Posts: 4
Max -
If you are alluding to the fact that the Sybase Database Configuration opens a transaction by default then I am aware of that. (SET CHAINED OFF) Given that I cannot change the database configuration of our database ( that is fixed in the production environment). That is why I asked the question. Thinking that there may be a property that I can set in Hibernate to tell it not to do this when it open the Session.

Just as a side note. Instead of chatising me for not "using google" would not it have been more productive to simply give me a straight answer rather than chidding me like some bad child for not doing exactly what you did.

David


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 19, 2005 4:08 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
well, since you just pasted mappings with an exceptions asking "What do I need to do to fix this" then it looked to me like you didn't even chekked for SET CHAINED OFF ...if you had taken you the 3 seconds extra to write the question about wether there exist and option for you to control the connection settings then I could have answered immediatly with:

Use session.connection() to execute whatever JDBC required to change this state and if that is not enough then write your own implementation of ConnectionProvider that does the setup you need.

(and sorry if you felt offended but we get about 100 postings a day and 90% are questions easily answerable via google or rereading the docs)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 19, 2005 4:25 pm 
Newbie

Joined: Mon Sep 19, 2005 12:52 pm
Posts: 4
Max -
Now that was a useful post.

Thanks
David


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 19, 2005 4:30 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
(yes - but still much quicker answered via reread docs and google IMO ;)

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 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.