toplink « Annotation « JPA Q&A





1. The @JoinColumns on the annotated element [...] from the entity class [...] is incomplete    stackoverflow.com

I make use of: NetBeans IDE 6.7.1, GlassFish v2.1, Oracle 10g XE, JAVA 6 SE, JAVA 5 EE. I have problem with an @ManyToMany annotation:

@ManyToMany(fetch=FetchType.EAGER)
@JoinTable(name="CUST_RENT_MOVIE", joinColumns={@JoinColumn(name="CUST_ID")}, inverseJoinColumns={@JoinColumn(name="TITLE")})
private Collection<CustRentMovie> rents = new ...

2. Why cannot join 3rd table using JPA TopLink annotation?    stackoverflow.com

I have simple 3 tables:

Users
-id
-name

Addresses
-id
-user_id  //FK
-location

Phone
-id
-number
-address_id //FK
  • Users can have many Addresses
  • Addresses can have many Phone
Thus, annotations applied to each entity class would look like: Users
    @OneToMany(cascade = CascadeType.ALL, ...