Re: Hibernate in JBoss: You cannot commit during a managed transaction!

From: Carlo Luib-Finetti (carlo.lf_at_onlinehome.de)
Date: 12/27/04

  • Next message: Filip Matošić: "Count num. of columns in a table"
    Date: Mon, 27 Dec 2004 13:13:29 +0100
    
    

    Carlo LF schrieb:
    >>Are you getting an instance of Hibernate through JBoss or on your
    >
    > own.
    >
    > I bound the Hibernate SessionFactory into JBoss JNDI as Bauer/King
    > adviced in their book 'Hibernate in Action', so I get a Hibernate
    > Session by doing a lookup for the SessionFactory.
    >
    > If I understand the book from above, it says that Hibernate is smart
    > enough to detect if it is running in a managed environment, where
    > transactions are governed by a separate Transaction Manager (which,
    > btw, you have to configure in Hibernate's global configuration). So I
    > thought, that a statement which commits a Hibernate transaction,
    > simply does nothing, but 'waits' until the JBoss TX manager commits
    > the transaction.
    >
    > Carlo Luib-Finetti
    I have found the solution at
    http://forum.hibernate.org/viewtopic.php?t=935847

    "You're trying to commit from within a bean running in a managed
    environment (ie JBoss).

    You need to change the transaction strategy so enable HB integration
    with JTA

    In hibernate.properties, change the factory_class property

    hibernate.transaction.factory_class=net.sf.hibernate.transaction.JTATransactionFactory

    Look into Hibernate in Action, Chapter 2, section 2.3.3 if you need
    further information§


  • Next message: Filip Matošić: "Count num. of columns in a table"

    Relevant Pages

    • JBoss, PostgreSQL, XDoclet, Serial primary keys in CMP
      ... I'm trying to get a simple container managed bean to work with JBoss ... assuming you know what you're doing) of getting a data access layer. ... I've also looked at Hibernate, but wonder about my Hibernate classes ... was with Data Access Object, but with added features such as versioning. ...
      (comp.lang.java.programmer)
    • Hibernate in JBoss: You cannot commit during a managed transaction!
      ... I bound the Hibernate SessionFactory into JBoss JNDI as Bauer/King ... transactions are governed by a separate Transaction Manager (which, ...
      (comp.lang.java.databases)
    • Re: EJB 3.0 vs Spring
      ... or Spring with a Web Server ... EJB3 has improved things greatly, particularly with entity beans, but it still might be a bit early to depend on it. ... The JBoss implementation is in beta and is buggy. ... My experience with JBoss + Hibernate + EJB 3.0 was OK until I hit a bug that required an upgrade that quickly descended into a mess of seemingly irreconcilable inter-dependencies. ...
      (comp.lang.java.programmer)
    • Re: CMP without entity beans ?
      ... JBoss), so i've started studying "JBoss at work, a practial guide". ... the CMP chapter uses Hibernate ... instead of Entity Beans. ...
      (comp.lang.java.programmer)
    • MappingException with Hibernate and JBoss
      ... I am running JBoss 3.2.5 and have gone through all the tutorials that I ... least some of the Hibernate classes are accessible (they are being ...
      (comp.lang.java.databases)