-->
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.  [ 7 posts ] 
Author Message
 Post subject: Insert Query run only in unchained transaction
PostPosted: Fri Jan 16, 2004 11:26 am 
Newbie

Joined: Mon Dec 15, 2003 6:25 am
Posts: 7
Hello,

I have a problem with a transaction and particularly the transaction mode
when i open a transaction with those instructions to make an insert operation

session = sessionFactory.openSession();
transaction = session.beginTransaction();

I have this message about the transaction mode which said we should be in an unchained transaction mode.
What can i do with the connection to resolve this kind of problem?

- could not insert: [com.reuters.kplus.ssdb.entities.Country#130632]
com.sybase.jdbc2.jdbc.SybSQLException: Stored procedure 'DataMvts_insert' may be run only in unchained transaction mode. The 'SET CHAINED OFF' command will cause the current session to use unchained transaction mode.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 16, 2004 12:46 pm 
Newbie

Joined: Mon Dec 15, 2003 6:25 am
Posts: 7
Ooops, i forgot to indicate that this only happens with Sybase ASE (12.5).
It works fine with MySQL.

I will welcome any suggestions.
Alexis


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 16, 2004 1:50 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
This is very DB specific,
Did you try to add SET CHAINED OFF in your stored proc ?

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 19, 2004 6:29 am 
Newbie

Joined: Mon Dec 15, 2003 6:25 am
Posts: 7
emmanuel wrote:
This is very DB specific,
Did you try to add SET CHAINED OFF in your stored proc ?


I would probably agree with your proposition and i thank you but
the problem remains because i cannot change the stored proc for a few reason there are too many stored proc and we can't do it because of our product taht does not give enough flexibility.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 19, 2004 6:57 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Well, if your stored procedures can't run inside of a plain jdbc transaction provided by the JDBC driver for your database, this can't be hibernates problem. Either change your stored procedures or make your db vendor remove that restriction.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 19, 2004 1:26 pm 
Newbie

Joined: Mon Dec 15, 2003 6:25 am
Posts: 7
We made a plain JDBC sample and it works fine.
Playing with it, we managed to figure out that the previous error to occured if our insertion operation was done within a transaction. The transaction is started by calling setAutoCommit(false) before doing the insertion (the insertion operation trigger a stored procedure).

Going back to our hibernate sample, we managed to remove the error by removing call to session.beginTransaction() & session.commit().

While this works, it does not allows transaction. We found the following tips that provides another solutions (changing the stored procedure execution mode constraint):

http://swssun00.isbe.ch/docs/java/jConn ... EADING5-89

Any other solutions is welcome.

Alexis


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 19, 2004 3:54 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Transaction boundaries are probably set in your stored proc boundaries.
Hum, that's sucks.

Any scripting adding 'SET CHAINED OFF' automaticaly in your SP ?

_________________
Emmanuel


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