3 Replies Latest reply on Jul 24, 2006 2:41 PM by gavin.king

    Entity Beans, Hibernate, etc.

    texan

      I'm really unclear on the relationship between EJB Entity Beans and Hibernate, with respect to Seam. I haven't used Entity Beans for years and years, back when they were declared evil and unusable. I've always used CMP session beans and either home grown persistence (ugh) or Hibernate.

      It's probable that Entity Beans have improved considerably since the dark age of their inception, but with the growth of Hibernate, I never saw any need for them. I had (have) no interest in having my entities be distributed objects, so I didn't see any use for them.

      Having said all that, how does all this work with Seam? The examples seem to fall into the categories of "with EJB" and "with no EJB". What about using EJB3 session beans and Hibernate persistence? Are there arguments for or against this?

        • 1. Re: Entity Beans, Hibernate, etc.
          gavin.king

          EJB 3.0 entity beans are modelled after Hibernate and other POJO-based ORM solutions, and the Hibernate team was deeply involved in writing the new spec.

          And, of course, in JBoss, the EJB 3 persistence implementation is just a very thin wrapper around Hibernate.

          At a high level there is very little difference between using Seam with Hibernate or EJB3 persistence, though obviously Hibernate is more feature-rich.

          • 2. Re: Entity Beans, Hibernate, etc.
            texan

            Gavin,

            Thanks for the quick reply! If I needed (or just wanted) to use Hibernate, could I still use session beans with Seam? Is it all or nothing?

            • 3. Re: Entity Beans, Hibernate, etc.
              gavin.king

              Of course, you can inject a Seam-managed Hibernate session into a session bean. Or, when running in JBoss, you can get the underlying Hibernate session from the EJB3 EntityManager anytime you like.