-->
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.  [ 2 posts ] 
Author Message
 Post subject: whole app don't work with db connection pooling
PostPosted: Wed Aug 30, 2006 6:05 am 
Beginner
Beginner

Joined: Thu Nov 20, 2003 12:29 pm
Posts: 39
Hello,
i have a application with a lot of unit test and everythings running fine whe i used the hibernate-build-in connection pool.
If i switch to c0p3 or proxool i get a lot of (connection unrelated) Exceptions, like:
(1)
org.hibernate.StaleStateException: Unexpected row count: 0 expected: 1
at org.hibernate.jdbc.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:27)
at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2291)
...

(2)
null id in com.ms.model.user.Group entry
at org.hibernate.event.def.DefaultFlushEntityEventListener.checkId(DefaultFlushEntityEventListener.java:48)
at org.hibernate.event.def.DefaultFlushEntityEventListener.getValues(DefaultFlushEntityEventListener.java:150)
at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:106)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:195)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:76)
at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:35)
...

(3)
org.hibernate.exception.ConstraintViolationException: could not insert: [com.ms.model.user.Group]
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:1986)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2405)
...

occurs.
Any general hints what the problem could be ?
regards
Johannes


Top
 Profile  
 
 Post subject: Re: whole app don't work with db connection pooling
PostPosted: Wed Aug 30, 2006 6:49 am 
Beginner
Beginner

Joined: Thu Nov 20, 2003 12:29 pm
Posts: 39
Could it be, that if you use a connection pool, the use of transactions is mandatory ?

fe:
Code:
SessionFactory factory = new Configuration().configure().buildSessionFactory();
        Session session = factory.openSession();
User user = new User("ulf");
session.save(user);
session.flush();
session.close();

stores the user in db if no respctively the build-in connection pool is used.
Else the db is empty.
If i wrap the save-call in beginTransaction and commit, then the user gets saved also if i use c3p0 or proxool.

?
Johannes


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