[jboss-user] [EJB 3.0] - Re: ManyToMany constraints problem
martinwhs
do-not-reply at jboss.com
Thu Dec 7 10:51:06 EST 2006
Is there a reason for the usage of CascadeType.PERSIST on the many-to-many relationship in the etiquetas class?
Since that very relationship is mapped by the etiquetas field in the libros class, you probably won't ever manipulate the collection of libros in the etiquetas, but only do reads on it. Therefor I would suggest removing the cascadeType in the etiquetas class.
The decision wether to use cascading on relationships affects the way you use the entitymanager. You can do everything without cascading, it is just less comfortable (more persist and merge calls). In this very case you would have to manage the etiquetas seperatly. This is maybe a good idea, since they don't seem to form a composition with libros (can live without them).
If you don't feel comfortable with cascading, then you can turn it off and do things manually.
Best regards,
Martin
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3991984#3991984
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3991984
More information about the jboss-user
mailing list