-->
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: Dynamic mapping and transaction not working
PostPosted: Tue Dec 26, 2006 12:25 pm 
Beginner
Beginner

Joined: Sun Feb 19, 2006 5:13 am
Posts: 22
Hi All

I use the dynamic mappings and I don get the transaction working.

Accoring to the manual:

Session dynamicSession = pojoSession.getSession(EntityMode.MAP);

// Create a customer
Code:
Map david = new HashMap();
david.put("name", "David");
dynamicSession.save("Customer", david);
...
dynamicSession.flush();
dynamicSession.close()
...
// Continue on pojoSession

Please note that the call to getSession() using an EntityMode is on the Session API, not the SessionFactory. That way, the new Session shares the underlying JDBC connection, transaction, and other context information. This means you don't have tocall flush() and close() on the secondary Session, and also leave the transaction and connection handling to the primary unit of work.

This is what I do:

Code:
Session mapSession = sessionFactory.getCurrentSession().getSession(EntityMode.MAP);
            mapSession.saveOrUpdate(metadataModelToSaveWith.getName(), metadataObject.getMetadata().getMap());



What Im saying here is that the primaty unit of work is NOT handling the flush since nothing gets saved. I use hibernate in a ASpring application running on JBoss.


Anyone had the same problem or has a solution?

Cheers
Magnus


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.