3 Replies Latest reply on Apr 6, 2005 10:41 AM by Emmanuel Bernard

    Hibernate dependency of detached entities

    Peter Kozelj Newbie

      Hi,

      I am playing with EJB3-Preview4 to see if the technology is suitable for my next project.
      One thing I noticed is that the detached entities remain hibernate dependant even with eager loading (org.hibernate.collection.PersistentSet).

      This may be fine or even desirable for web application that runs in the same JBoss instance,
      but causes problems with standalone clients:
      1. You have to put hibernate3.jar into the client which feels wrong
      (application becomes dependant on specification implementation)
      2. Even if the first point would be acceptable, hibernate3.jar file size is over 1.3MB.
      This is a showstopper for web start clients or J2ME.
      3. This kind of objects can not be serialized with anything but java serialization (hessian)

      So, is this just a preview thing or should we use old fashioned DTOs?

      Regards,
      Peter

        • 1. Re: Hibernate dependency of detached entities
          Jens Elkner Apprentice

           

          "3.14r" wrote:

          2. Even if the first point would be acceptable, hibernate3.jar file size is over 1.3MB.
          This is a showstopper for web start clients or J2ME.


          Yes, and do not forget cglib-full-2.0.1.jar + commons-logging.jar + concurrent.jar ~ 0.5 MB

          (I hope, JBoss will at least from 5.x on use the improved concurrent utils from Java 1.5 ...)

          • 2. Re: Hibernate dependency of detached entities
            Bill Burke Master

             

            "3.14r" wrote:
            Hi,

            I am playing with EJB3-Preview4 to see if the technology is suitable for my next project.
            One thing I noticed is that the detached entities remain hibernate dependant even with eager loading (org.hibernate.collection.PersistentSet).

            This may be fine or even desirable for web application that runs in the same JBoss instance,
            but causes problems with standalone clients:
            1. You have to put hibernate3.jar into the client which feels wrong
            (application becomes dependant on specification implementation)
            2. Even if the first point would be acceptable, hibernate3.jar file size is over 1.3MB.
            This is a showstopper for web start clients or J2ME.
            3. This kind of objects can not be serialized with anything but java serialization (hessian)

            So, is this just a preview thing or should we use old fashioned DTOs?


            These are all good points. I'll bring this up with the Hibernate team to see if there is a solution.

            Regards

            • 3. Re: Hibernate dependency of detached entities
              Emmanuel Bernard Master

              Hi Peter,
              I agree with you, some environments are not suitable to embed Hibernate3 and its needed dependencies.
              We're thinking of an hibernate-client.jar to make this easier. You should find a JIRA issue in the hibernate web site. Vote for it :-)
              The other option is to use bytecode enhancement. We're not keen on this because it adds a build time processing to your classes before any deployment and slows down a bit the developement process.

              I disagree with you on the dependency. Your deployment is implementation dependent but not your code, thus you can switch quite easily.

              Right now, consider using the DTO pattern for clients when size does matter.

              PS: JDK 5.0 concurrent package is not used by Hibernate to keep compatibility with previous JDKs.