-->
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: setting isolation levels in db2/ as400 with hibernate
PostPosted: Fri Aug 22, 2008 6:15 am 
Newbie

Joined: Thu Aug 21, 2008 5:28 am
Posts: 4
Location: india
I am using hibernate with DB2/AS400.
When I set any isoltion level other than '0' in the hibernate.cfg.xml and try to insert/update data in the table on DB2/AS400, The Exception '' could not update :" occurs.

Update is succesful for isolation level 0. Please guide how this can be solved.

Following is the error stack trace.

could not update: [com.test.dto.TestDTO#10]
org.hibernate.exception.GenericJDBCException: could not update: [com.test.dto.TestDTO#10]
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:91)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:79)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2221)
at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2117)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2373)
at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:84)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:243)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:227)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:141)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:296)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:905)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:345)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
at com.test.dao.TestDAO.insertData(TestDAO.java:72)
at com.test.dao.TestDAO.main(TestDAO.java:117)
Caused by: java.sql.SQLException: [SQL7008] APAP0400 in TRUGER not valid for operation.
at com.ibm.as400.access.JDError.throwSQLException(JDError.java:650)
at com.ibm.as400.access.JDError.throwSQLException(JDError.java:621)
at com.ibm.as400.access.AS400JDBCStatement.commonExecute(AS400JDBCStatement.java:896)
at com.ibm.as400.access.AS400JDBCPreparedStatement.executeUpdate(AS400JDBCPreparedStatement.java:1154)
at org.hibernate.jdbc.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:23)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2203)
... 13 more
_________________


I would like to add that if we set property autocommit "true" in hibernate.cfg file or through connection().setAutocommit() then I am able to use higher isolation levels like 2,4 or 8. But the data is actually not updated in the database.

Ya using journaling solves the problem, but our requirement does not allow to use journaling.

So in short, the exact problem is that I need to use higher isolation levels (2,4 or 8) and update data in the database (db2/AS400) without use journaling.

_________________
saurabhjain


Top
 Profile  
 
 Post subject: Connection configuration
PostPosted: Fri Aug 22, 2008 3:22 pm 
Newbie

Joined: Fri Aug 22, 2008 11:07 am
Posts: 6
Location: Italy
Hi,
try setting connection configuration:
binary=true

and active journal on as400 table

Bye


Top
 Profile  
 
 Post subject: Re: Connection configuration
PostPosted: Sat Aug 23, 2008 7:06 am 
Newbie

Joined: Thu Aug 21, 2008 5:28 am
Posts: 4
Location: india
claudio.casoli wrote:
Hi,
try setting connection configuration:
binary=true

and active journal on as400 table

Bye


Actually we cannot use journaling on tables as per requirement. Please also tell where to set "connection configuration:
binary=true"

_________________
saurabhjain


Top
 Profile  
 
 Post subject: connection settings
PostPosted: Mon Aug 25, 2008 4:38 pm 
Newbie

Joined: Fri Aug 22, 2008 11:07 am
Posts: 6
Location: Italy
Hi
you can set connection configuration on your driver configuration on application server setting custom properties.
set
Code:
translate binary=true;

on jdbc connectin

If you haven't a jndi connection you can set properties on hipernate properties too:
hibernate.connection.url=jdbc:as400://servername/as400lib;translate
binary=true;extended dynamic=true;

If you need to update table the journal is necessary.

Bye
[/code]


Top
 Profile  
 
 Post subject: connection settings
PostPosted: Mon Aug 25, 2008 4:38 pm 
Newbie

Joined: Fri Aug 22, 2008 11:07 am
Posts: 6
Location: Italy
Hi
you can set connection configuration on your driver configuration on application server setting custom properties.
set
Code:
translate binary=true;

on jdbc connectin

If you haven't a jndi connection you can set properties on hipernate properties too:
hibernate.connection.url=jdbc:as400://servername/as400lib;translate
binary=true;extended dynamic=true;

If you need to update table the journal is necessary.

Bye


Top
 Profile  
 
 Post subject: Re: setting isolation levels in db2/ as400 with hibernate
PostPosted: Sun May 10, 2009 8:02 pm 
Newbie

Joined: Sun May 10, 2009 4:56 pm
Posts: 3
Hi there,
Quote:
If you need to update table the journal is necessary.


Are you saying you can't use Hibernate unless journaling is active? What if the requirement is to disable journaling?

-Daniel


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.