[jboss-user] [EJB 3.0] - Re: Need some help with mapping

fhh do-not-reply at jboss.com
Fri Mar 30 09:51:24 EDT 2007


Well, I think your ERM is broken. I think you will need three classes:

-Item, to represent the information about the item. This contains an @EmbeddedId property of the ItemPK.

-ItemPK, the primary key of the Item class. Should be annotateed @Embeddable. (BTW: Why do you store a TABLE_NAME. Does this refer to a table in the db? This sounds fishy.). Make sure you implement equals and hashcode-methods.

- Create a Store Class which holds a Collection of Items (Set) as one of its properties and use @ManyToMany with an adequat @JoinTable.

I cannot see why a store should extend an item. Do they share any properties except the pk of the item?

Regards

Felix

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

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



More information about the jboss-user mailing list