2010-09-08 58 views

回答

0

你並不需要指定@JoinColumn註解都:

@Entity 
public class PrimaryEntity { 

    @OneToMany(mappedBy = "primaryEntity") 
    public List<RelatedEntity> getRelatedEntities() { 
     return relatedEntities; 
    } 

} 

@Entity 
public class RelatedEntity { 

    @ManyToOne 
    public PrimaryEntity getPrimaryEntity() { 
     return primaryEntity; 
    } 

}