entitymanager « Transaction « JPA Q&A





1. Can a single EntityManager (Hibernate) participate in multiple concurrent transactions?    stackoverflow.com

Is there a way one EntityManager can participate smoothely in multiple concurrent transactions? Well, not that concurrent. Something like:

  1. Start tx 1
  2. Do stuff in tx 1
  3. Start tx 2
  4. Do stuff in tx 2
  5. Commit tx ...

2. How to detect transaction conflicts with Hibernate?    stackoverflow.com

I am using Hibernate 2.6 with hibernate-entitymanager. I am trying to catch and handle situations when 2 transactions conflict on an object. Here is what happens: Two threads are updating a single ...

3. Using injected EntityManager in class hierarchies    stackoverflow.com

The following code works:

@Stateless
@LocalBean
public class MyClass 
{
       @PersistenceContext(name = "MyPU")
       EntityManager em;


       ...

4. JPA - database gets updated only when method is @Transactional    stackoverflow.com

I've encountered a problem I don't really understand - unless a method working with the DAO is annotated as @Transactional, the underlying database doesn't get updated. My app runs on JPA/Hibernate, ...

5. multiple entitymanagers in a transaction    stackoverflow.com

I am writing an application that will move data from one database to another Using JPA EntityManager API. My questions are : 1. Can i use multiple entity managers in a ...

6. EntityManager doesn't see changes made in other transactions    stackoverflow.com

I'm writing some application for GlassFish 2.1.1 (JavaEE 5, JPA 1.0, as far as I know). I have the following code in my servlet (which I mostly borrowed from some sample ...

7. looking up entity manager in EJB Helper classes    stackoverflow.com

I am trying to inject entity manager in some helper class, I can pass it to the helper from the session bean, but the problem is I need to use the ...

8. JPA : applicationManaged EntityManager for JSE to control transaction lifecycle programmatically    stackoverflow.com

I'm having difficulties finding a good solution to support this feature where the UI can start and commit the transaction. In my previous approaches in working with transactional applications, i group the ...

9. EntityManager Transaction is pending because another EntityManager transaction is still in process    stackoverflow.com

HI, I have a new EntityManager and I am calling begin transaction on it. This transaction tries to update a column in table a (called when user tries to log in). While ...





10. Hibernate Entity manager auto flush before query and commit changes to DB in transaction    stackoverflow.com

I am using Hibernate 3.6.0 with JPA 2 on Jboss AS 6.0.0 final. In an EJB of mine, there's a method which updated entity values and do some query on it. The ...

11. EJB 3.1 Transaction, EntityManager    stackoverflow.com

I have an application which processes IQ stanzas via smack (eventbased java library). We now switch from vanilla Tomcat to glassfish 3.1 and i would like to switch to ejb 3.1.

@Stateless
public ...

12. When does EntityManager commit?    stackoverflow.com

I have the following service...

@Stateless
@LocalBean
public class RandomService {

    @EJB RandomString stringTokenizer;

    @PersistenceContext
    EntityManager em;

    public String generate(Actions action)
  ...

14. Glassfish, JPA, JTA, Hibernate & Lift - EntityManager not associated with JTA transaction    java.net

I have an EJB3 entity jar that I'm attempting to use in a Lift web application running on Glassfish, using Hibernate as the persistence provider. My JNDI data source is set up from the admin console, the Hibernate jars have been copied into $GLASSFISH_HOME/lib, and the web.xml of my Lift webapp includes the appropriate elements to enable me to look up ...

15. JPA Hibernate Entity Manager and autocommit ?    forum.hibernate.org

Newbie Joined: Fri Jan 23, 2004 4:02 am Posts: 6 Location: Linz, Austria I'm trying to use autocommit with a database accessed through Hibernate Entity Manager (JPA). After calling manager.persist() for a new object, this new object is not committed even though the driver has autocommit enabled. The persistence unit is configured as shown below: Code: ...

16. EntityManager and Transaction    forum.hibernate.org





17. CallBack Methods messing with EntityManager and Transaction    forum.hibernate.org

I have this problem and your help would be rellay appreciated ; I need to do some NamedQueries execution INSIDE a method marked as @PostPersist . I've read here and there that queries and entityManager should not be involved in callback methods , like this link explain : http://www.hibernate.org/hib_docs/entit ... eners.html is this really so ? How can i persist manually ...

18. entitymanager - transaction, commit, flush    forum.hibernate.org

Hi I have a question of the right usage of entity manager (EM). i have a complex entity that contains list of sub entities. i want to implement manual commit thingy. so i pesrsist entities then somewhere afterwards i do either em.flush() or em.getTransaction().rollback(). but something is wrong here for me. when i create entity manager, should i do em.getTransaction().beginTransaction()? when ...