-->
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: Different transactional(?) behaviour between Oracle/MSSQL
PostPosted: Wed Jul 14, 2004 5:46 am 
Newbie

Joined: Wed Dec 03, 2003 1:34 pm
Posts: 9
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 EJB to an MDB
4. the MDB tries to reload the new record

The DAO method is:
Code:

        session = getSessionFactory().openSession();

        room hibObject = populateHibObject(roomDto, session);
        try {
            session.save(hibObject, hibObject.getId());
           session.flush();
       } catch (HibernateException he) {
            logger.warn(he.getLocalizedMessage());
            throw new DAOException(he.getMessage());
       } finally {
            try {
                session.close();
            } catch (Exception e) {
                logger.warn(e.getLocalizedMessage());
                throw new DAOException(e.getMessage());
            }
       }


In MSSQL everything works as expected - the room is created and the MDB can reload the room. However, in Oracle this does not happen - I see
Quote:
net.sf.hibernate.ObjectNotFoundException: No row with the given identifier exists

exceptions.

Hibernate SQL debugging is identical for both platforms - when session.save() is called an insert is logged. If I step through the code in a debugger and watch what happens on the appropriate DB at the same time I see that when the insert statement is logged MSSQL shows a new room record - but with Oracle its only when the whole CMT method finishes that the insert happens. Is this behaving as expected? Or am I just missunderstanding how session.save() works in a transaction? If anyone can explain why it works like this I'd be most appreciative.


Versions:
Hibernate 2.0.3
Oracle 9i using thin JDBC driver
MS SQL Server 2000 with jTDS 0.7.1 driver

[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 14, 2004 6:54 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
You are most likely using different levels of transaction isolation.


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.