-->
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.  [ 1 post ] 
Author Message
 Post subject: how to force a commit?
PostPosted: Wed May 09, 2007 9:59 am 
Newbie

Joined: Wed Sep 07, 2005 8:22 am
Posts: 14
Hello all,

I'm having a little trouble forcing data to be commited during a bulk load operation.

I'll keep this as simple as I can.

I have a SessionBean that runs on a TimerService to wake up, check a directory for any new data, decode it and store it in the database.

After each 'saveOrUpdate' the transaction commited state returned is false. (see varible 'x').

Each item of data that is decoded, rely's on a previous piece of data.
So if I need to retreive a past piece of data before I can process the new piece.

for example. each piece of data related to a ID and a location. I need to find the last location of that ID before I store the new ID. This is make sure I don't store duplicate locations.


The order of the classes called is ...

1:SessonBean(TimerService) that calls a DelegateClass,
2:DeleateClass calls another SessionBean(PersistenceManager),
3:PersistenceManagerBean makes the Hibernate queries.

The issue I have is that whilst data is still being stored I get the exception of ...

Caused by: org.hibernate.exception.GenericJDBCException: Cannot open connection.
....
brevity
....
org.jboss.util.NestedSQLException: Transaction is not active: tx=TransactionImplXidImpl[FormatId=257, GlobalId=atr016/16433, BranchQual=, localId=16433]


I only get the exceptions under full load.

I presume this is related to the connections limit to MySql.
I'm unsure how to fix this though.


Can anyone help me out here? or at least point me in the direction/area I should be looking?

Thanks for taking the time to read this.
Jeff Porter



Hibernate version: 3.2
Mapping documents: NA
Code between sessionFactory.openSession() and session.close():

try {

hsession = factory.openSession();
hsession.setFlushMode(FlushMode.ALWAYS);
Transaction transaction = hsession.beginTransaction();

hsession.saveOrUpdate(tag);

hsession.flush();
transaction.commit();
boolean x = transaction.wasCommitted();
System.out.println("add tag(2) commited: ("+tag.getAssetID()+")" + x);

// x is always false at this point.
// moments later its commited to the db.
} catch (Exception e) {
// brevity
} finally {
if (hsession != null) {
hsession.close();
}
}


Full stack trace of any exception that occurs: NA
Name and version of the database you are using: MY SQL 5.x

The generated SQL (show_sql=true): NA


Problems with Session and transaction handling?
Read this: http://hibernate.org/42.html - Read it.


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

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.