• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

eclipseLink vs hibernate

 
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does anyone knows why hibernate needs Serializable for composite-id?

"composite-id must implement Serializable"

EclipseLink does not need it when running on the same vm.


Does anyone knows why hibernate needs to overwrite equals/hashCode for compositeId?

EclipseLink does not need it when running on the same vm.


Should I go for EclipseLink in future?
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Objects need to be Serializable in Hibernate so it will work in cluster and you can use whatever you like for second level caches (since these in turn may serialize stuff)


Does anyone knows why hibernate needs to overwrite equals/hashCode for compositeId?


Have a read of this.


Should I go for EclipseLink in future


If these two features are the only requirements you looks for in a n ORM, I suppose so.
 
nimo frey
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay, I sum up:

In Hibernate JPA2, I have to use for ALL my objects seriaziable not only for compositeID-Ojbects.

For example (Please correct me, if I am wrong):




The other thing is, according to http://community.jboss.org/wiki/EqualsandHashCode, it is a bad idea only using the ID-Fields of a Entity for equals/hashCode.


Thanks.
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes.


The other thing is, according to http://community.jboss.org/wiki/EqualsandHashCode, it is a bad idea only using the ID-Fields of a Entity for equals/hashCode.


As the article says, this is risky if you use detached collections. Otherwise, you are OK.
 
nimo frey
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Is this statement 1 right?:
Performance does suffer if I implement Serializable in all my Entities without the need to transmit entities between different jvm.

Is this statement 2 right?:
Both in eclipselink and hibernate, I have to use Serializable when transmitting entity state from one layer (persistence layer) to another (view layer - for example, jsf) even it is in the same jvm.
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Is this statement 1 right?:
Performance does suffer if I implement Serializable in all my Entities without the need to transmit entities between different jvm.


No.


Is this statement 2 right?:
Both in eclipselink and hibernate, I have to use Serializable when transmitting entity state from one layer (persistence layer) to another (view layer - for example, jsf) even it is in the same jvm.


No.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic