2 Replies Latest reply on Apr 27, 2007 3:58 AM by snau2005

    Differences in EJB3

    casss01

      Hi all,...

      i am hoping some of you can help me with providing me some additional information. I am going to do my first project what i'm not planning to do with JDBC. this time i want to use either Hibernate or EJB3 (with struts).
      after reading tons of articles about these 2 techniques i still dont know what the exact difference is. i have NEVER worked with EJB's (v2) so i have never experianced that is slow, difficult etc.

      i read that hibernate is fast, easy, and good for smaller projects. and i know that EJB 2 is something i should not use because its hard to learn, i have to do a lot of unnessesary files, etc... atleast that is what everyone is typing...
      but with EJB3, i only hear "its almost the same is hibernate". but what is different then, and when should i use what?

      I hope someone can give me some information about this...

      Thanks

        • 1. Re: Differences in EJB3
          casss01

          anybody?? please?

          • 2. Re: Differences in EJB3
            snau2005

            I'll try to answer, but do not trust my words 100% - I'm not an expert.

            EJB 2.1 its old so do not learn old technology that for sure.
            EJB 3.0 is a standard, it was made by Sun, hibernate, jboss etc (check sun page for details). But in creating EJB hibernate as I know was involved a lot of. But hibernate also made it's own API, annotanions, but almost the same.
            Jboss implementation is on top of hibernate engine. That means that if you call some of ejb function or use some ejb annotation you in reality call hibernate.
            But EJB 3 does not have some features which hibernate have.
            So normally I code everything using EJB 3, but I need some extra feature or something I'm using hibernate annotations or functions. You can always switch from EJB layer to hibernate (example:

            import org.hibernate.Session;
            import javax.persistence.EntityManager;
            
             @PersistenceContext (unitName="blabla")
             protected EntityManager em;
            
            
             Session session = ((Session)em.getDelegate());