-->
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: Reading uncommitted data in Hibernate 4?
PostPosted: Thu Oct 11, 2012 12:59 pm 
Newbie

Joined: Thu Oct 11, 2012 12:24 pm
Posts: 1
I'm in the process of upgrading to Hibernate 4 and fully implemented the Work API but am left with one issue. We have a legacy search API that needs to use the underlying connection within the Hibernate Session. How do other people deal with cases where the legacy systems require the same connection?

Code:
        _session.beginTransaction();  // Need explicit control over the transaction
        try {
            SomeEntity entity = createEntity();  // Use session to create an entity
            LegacySearchObject search = createSearch(entity); // Creates new Connection since Hibernate 4 doesn't allow us to get a handle on existing connection

            SearchResults searchResults = _session.executeQuery(search); // Flushes session as expected but since search is using a different connection, it can't retrieve the uncommitted data.
            assertEquals(1, searchResults.getRowCount()); // fails.  No results found.
        } finally {
            _session.rollback();
        }


This could be a serious limitation for us if I can't get a solution.

Thank you!


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.