[jboss-user] [EJB 3.0] - Re: EJB3: org.hibernate.type.SerializationException: could n

Wolfgang Knauf do-not-reply at jboss.com
Tue Apr 28 01:42:30 EDT 2009


Hi,

I hope I understand your design correct: your "Road" has a PK, which is actually another entity "Location". The "Location" has relationships to other "Road" entities.

I think this is quite a problematic design, because by loading the Road, it has to fetch the Location, and by fetching the location, it has to fetch all its related Roads (because of FetchType = EAGER), and from there it will fetch the other Locations and so on....

You suggest two different options:
1) You could create an artificial Primary Key on "Location" and "RoadPK"  just references this ID. The ROADS entity might have a one-to-one-relationship to a Location and an autogenerated ID (instead of the PK of type "Location").
2) You might also try to set the relataionships from Location to Road to "LAZY". But I don't know whether this works.

The latter will bring other difficulties: http://www.jboss.org/community/wiki/EJB3relationships

Hope this helps

Wolfgang

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4227158#4227158

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4227158



More information about the jboss-user mailing list