• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

eclipseLink vs hibernate

 
nimo frey
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • 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?
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • 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
  • 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
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • 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
  • 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
Eclipse IDE Hibernate Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic