Discussions

General J2EE: What is that EJB has that Hibernate doest not.

  1. Hi,

       I would like to know what can I do with EJB. That is not posible doing with Hibernate.?

       Is there some feature out there that can not be achived with Hibernate?


    Saludos,
       -Rory
  2. 1. Remote access.

    2. Declarative security.

    3. Declarative transactions.

    4. Distributed transactions.

    5. Based on standards.

    EJBs are about more things that just saving data to the database.

    Also, EJB and Hibernate are not an "either/or" proposition. Many people use the two technologies together: Session EJB that use Hibernate classes instead of Entity Beans are common.
  3. Paul I have a few questions...

    1. Remote access.
    2. Declarative security.
    3. Declarative transactions.
    4. Distributed transactions.
    5. Based on standards.

    I Agree with that. But another question would be.

    If I use (Session EJB + Hibernate) instead of (Session EJB + Entity Beans), can I still have:

    - Remote Access? Yes I think?.
    - Declarative security.? JAAS?
    - Declarative transactions. I think we still can? right?
    - Distributed transactions. Yes or No?.


    Will EJB/3 (Entity Beans) specification be easy like Hiberante/TopLink/iBATIS?.

    Regards,
       <Rory/>
  4. If I use (Session EJB + Hibernate) instead of (Session EJB + Entity Beans), can I still have:
    Remote Access, declarative security, declarative transactions? Yes, but only on the Session EJB. In most cases, this is good enough.

    JAAS? JAAS support is (unfortunately) not specified in the standard. You will need to use some sort of server-specific mechanism to integrate JAAS authetication with EJB security.

    Distributed transactions? Yes, with some care. Things will work provided that:

    1. You use a separate Hibernate session for each database.
    2. You connect to the databases via a DataSource retrieved from the EJB server.
    3. You use XA-compliant JDBC drivers for all databases.
    4. You don't use Hibernate's transaction management API.

    Your Hibernate operations will also be in the same transaction with other XA-compliant resources (such as JMS operations).
    Will EJB/3 (Entity Beans) specification be easy like Hiberante/TopLink/iBATIS?
    All I know is what is reported here. So far, it looks like EJB 3 will be more Hibernate-like, and Gavin King seems to have a fair amount of influence on the emerging EJB 3.0 spec.