views:

117

answers:

1

I'm using JPA but I'm not sure how to use it for relation between two classes. I need to connect them @OneToMany. I have done this before but forgot. Is there any good tutorial for this or an example that is easy to understand.

By the way this is a Flex application where I'm using BlazeDS for connection between Java and Flex.

+1  A: 

Have a look at the Introduction to the Java Persistence API in The Java EE 5 Tutorial and more precisely the section on Multiplicity in Entity Relationships.

Pascal Thivent
I have already seen this. But what I need is an example or tutorial for how to write the code correctly.For the moment I'm not sure about how to map @OneToMany ??? With what class???
dejaninic
@dejaninic There are two examples in the tutorial (http://java.sun.com/javaee/5/docs/tutorial/doc/bnbrt.html and http://java.sun.com/javaee/5/docs/tutorial/doc/bnbsw.html). Without details on your object model, it's impossible to provide more guidance (how could readers tell you how to map your classes if you don't say anything about them?).
Pascal Thivent