-->
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.  [ 3 posts ] 
Author Message
 Post subject: Use JPA with JDBC Transaction isolation
PostPosted: Fri Jul 04, 2008 7:33 am 
Newbie

Joined: Tue Jul 01, 2008 2:56 pm
Posts: 4
Hello,

how is it possible to configure Hibernate while using JPA Annotations and entitymanager to use Transaction demarcation with plain JDBC?

The examples and tutorials do this while accessing the Session through the factory and start an transaction, like described here: http://hibernate.org/42.html

I haven't found an option to set this in case of JPA. Since i don't create the EntityManager/Factory through the configuration of Hibernate.

How can I accomplish this?

Hibernate version: 3.2.6

thanks for the Help


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 04, 2008 12:51 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
you can still set all hibernate-specific options in persistence.xml

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 04, 2008 4:45 pm 
Newbie

Joined: Tue Jul 01, 2008 2:56 pm
Posts: 4
Hey thanks for the answer,
but i figured out a much simpler way:

Code:
EntityManagerFactory emf = Persistence.createEntityManagerFactory("myunit");

EntityManager em = emf.createEntityManager();
EntityTransaction tx = em.getTransaction();
tx.begin();

// persist and do stuff

tx.commit();



But yesterday after hours of looking for the wrong places, I just could not figure that out.

thanks again.
3bit


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