behaviour « Transaction « JPA Q&A





1. Wierd behaviour. Hibernate optimistic locking error    coderanch.com

Hello guys, Iv got this really weird behavior in my hibernate. I'v got a transactional service method, code is below: public Customers applyForPartnerAccount(Customers customer) throws CustomersSQLException, CustomersException { logger.debug("Starting Partner Application transaction."); if(customer == null) { throw new CustomersSQLException("Can not apply account to a null or empty customer."); } if(!isValidForPartnerApplication(customer.getPartner())) { throw new CustomersException("Customer is not allowed to apply for a ...

2. Behaviour of Transaction Rollback    forum.hibernate.org

I noticed an interesting behaviour of Hibernate transaction when testing tx.rollback(). I loaded an existing record from database, updated one of the fields and saved it. Then I called tx.rollback(). The record was not updated in database, which was the expected behaviour of a rollback. However, if I create a new object and save it, tx.rollback() does not seem to work. ...

3. Clarification of session.lock() behaviour    forum.hibernate.org

hi, i was just looking for a quick clarification of session.lock(). i'm using disconnected objects with multiple sessions and want to be able to load an object, perform simple modifications then reassociate the object with a new session to lazy load a collection without saving any changes that have been made. should i use LockMode.NONE? if i use LockMode.READ to have ...

4. Commit unexpected behaviour    forum.hibernate.org

hi guys, release 2.1.2 DB oracle 8i (simplified) Domain Model A many-to-one B (non bidirectionnal + cascade = all) use case: 0- //beginTransation 1- creating new B instance 2- session.save(b); // sequence is hit --> ok 3- session.find ("from A a where a.aId = 123); // flush is triggered, insert of new b is executed --> ok 4- a.setB(b) // nothing ...

5. Different transactional(?) behaviour between Oracle/MSSQL    forum.hibernate.org

Hi, I'm seeing different behaviour in exactly when a Hibernate generated DB operation actually occurs on the DB when I swap between MSSQL and Oracle. The basic program flow is: 1. a create method in a CMT EJB is called 2. this calls a create method in DAO to create a record 3. a JMS message is then sent from the ...

7. setting autocommit causes strange cache behaviour    forum.hibernate.org

Hibernate version: 2 I am investigating a problem with an application which is using the 'detached objects' strategy within a web application. The problem is that although a call to close the session is made - it appears that the cache is not cleared. Thus when a subsequent call is made, the contents of the cache are returned - not reflecting ...

8. Strange behaviour with suspend & rollback    forum.hibernate.org

Connection connection = session.connection(); try { ... ...

9. Weird CMT/BMT transaction behaviour    forum.hibernate.org

Hello, I am experiencing a problem whereby I begin a new transaction and attempt to save an object, I run into a RollBackException. The code for persisting my object is roughly the following: Session s = sfac.openSession(); org.hibernate.Transaction tx = null; try { tx = s.beginTransaction(); s.save(batch) However, upon calling save() I consistently get an exception informing me that the transaction ...





10. Optimistic locking behaviour implementation    forum.hibernate.org

Hi, I am trying to implement optimistic concurrency behaviour in my web application which uses Hibernate in persistence layer and Struts in web layer with stateless EJB Business layer in between. I wanted to make use of StaleObjectStateException thrown by Hibernate whenever it finds version mismatch. We have used default setting of Flush mode as 'Auto'. So, I caught the staleObject ...

11. Weir behaviour. Optimistic locking error    forum.hibernate.org

Newbie Joined: Mon Aug 03, 2009 11:12 pm Posts: 5 Hello guys, Iv got this really weird behavior in my hibernate. I'v got a transactional service method, code is below: Code: public Customers applyForPartnerAccount(Customers customer) throws CustomersSQLException, CustomersException { logger.debug("Starting Partner Application transaction."); ...