Hibernate or CMP


General J2EE: Hibernate or CMP

  1. Hibernate or CMP (4 messages)

    I was reading about Hibernate but have never used it for persistence. One think i found difficult to understand is why will anyone use Hibernate if they have a option of using a CMP Entity beans.

    Any thoughts around this are welcome ?

    Threaded Messages (4)

  2. Hibernate or CMP[ Go to top ]

    because cmp is crap
  3. Hibernate or CMP[ Go to top ]

    Hibernate is smaller, lighter, and easier to use compared to the EJB mega-frameworks.

    Hibernate is transparent, in that your model contains no persistence code of any kind. All you need is to provide a default, parameterless constructor.

    Another advantage to hibernate is that it only deals with JDBC, allowing it to use a very SQL like query language.

    For more information, a great book on Hibernate and other ejb alternatives is "Better, Faster, Lighter Java," by Bruce Tate and Justin Gehtland

    Hibernate vs Toplink vs CMP : https://www.theserverside.com/discussions/thread.tss?thread_id=27037

    Spring/Hibernate vs J2EE / EJB :
  4. Hibernate or CMP[ Go to top ]

    Your question should have read: "Why will anyone use CMP Entity Beans if they have the option of using Hibernate."

    But seriously, here are a few reasons:

    1- Hibernate is more powerful.
    You can express many things with Hibernate that cannot be done with CMPs (At least without resorting to Server specific functions, which would make your app less portable). Things like ordering of results, placing limits/offset on the data you require (usefull for paging). Dynamic queries etc.
    2- Hibernate uses POJOs.
    This brings many benefits, such as the ability to run outside of a J2EE app server. (For example I can run junit tests on my DAO layer during my build cycle.
    3- Performance
    4- Easy of use
  5. Let me tell you what I know is,
    Hibernate is more usefull than ejb b'coz it is simple, no need to create a structure There is less database connectivity code Easier to use when your database is varring that is for extensibity It uses cashing so less database transaction
    If there is any wrong conception, Please tell me at uday_thakare1981 at yahoo dot com