Have a look here...
JSR220 2.1.8.5.1 Unidirectional OneToMany Relationships
The following mapping defaults apply:
Entity A is mapped to a table named A.
Entity B is mapped to a table named B.
There is a join table that is named A_B (owner name first). This join table has two foreign key
columns. One foreign key column refers to table A and has the same type as the primary key of
table A. The name of this foreign key column is formed as the concatenation of the following:
the name of entity A; "_"; the name of the primary key column in table A. The other foreign
key column refers to table B and has the same type as the primary key of table B and there is a
unique key constraint on it. The name of this foreign key column is formed as the concatenation
of the following: the name of the relationship property or field of entity A; "_"; the name
of the primary key column in table B.
Example:
@Entity
public class Employee {
private Collection<AnnualReview> annualReviews;
@OneToMany
public Collection<AnnualReview> getAnnualReviews() {
return annualReviews;
}
public void setAnnualReviews(Collection<AnnualReview> annualReviews)
{
this.annualReviews = annualReviews;
}
...
}
@Entity
public class AnnualReview {
...
}
In this example:
Requirements on the Entity Class Enterprise JavaBeans 3.0, Final Release Entities
33 5/2/06
Sun Microsystems, Inc.
Entity Employee references a collection of Entity AnnualReview.
Entity AnnualReview does not reference Entity Employee.
Entity Employee is the owner of the relationship.
The following mapping defaults apply:
Entity Employee is mapped to a table named EMPLOYEE.
Entity AnnualReview is mapped to a table named ANNUALREVIEW.
There is a join table that is named EMPLOYEE_ANNUALREVIEW (owner name first). This
join table has two foreign key columns. One foreign key column refers to table EMPLOYEE
and has the same type as the primary key of EMPLOYEE. This foreign key column is named
EMPLOYEE_<PK of EMPLOYEE>, where <PK of EMPLOYEE> denotes the name of the primary
key column of table EMPLOYEE. The other foreign key column refers to table ANNUALREVIEW
and has the same type as the primary key of ANNUALREVIEW. This foreign key
column is named ANNUALREVIEWS_<PK of ANNUALREVIEW>, where <PK of ANNUALREVIEW>
denotes the name of the primary key column of table ANNUALREVIEW. There
is a unique key constraint on the foreign key that refers to table ANNUALREVIEW.