I am using eclipse and eclipselink with maven dependencies to create my entities from my tables in my database. The problem is when I create the entities with the eclipse wizard, it gives me couple of errors, like:
Multiple markers at this line
- Inverse join column "addresses_address_ID" caot be resolved on table
"customers_addresses"
- Join column "customers_customer_ID" caot be resolved on table "customers_addresses"
I read the same problems, but they didn't work in my case: @OneToMany without inverse relationship and without a join table?
Here is one of my created classes:
import java.io.Serializable;
import javax.persistence.*;
import java.util.Date;
import java.util.List;
/**
* The persistent class for the customers database table.
*
*/
@Entity
@Table(name="customers")
@NamedQuery(name="Customer.findAll", query="SELECT c FROM Customer c")
public class Customer implements Serializable {
private static final long serialVersionUID = 1L;
@Id
private int customer_ID;
@Temporal(TemporalType.DATE)
@Column(name="date_of_birth")
private Date dateOfBirth;
@Column(name="first_name")
private String firstName;
@Column(name="last_name")
private String lastName;
//bi-directional many-to-many association to Address
@ManyToMany
@JoinColumn(name="customer_ID")
private List<Address> addresses;
//bi-directional many-to-many association to Package
@ManyToMany
@JoinColumn(name="customer_ID")
private List<Package> packages;
//bi-directional many-to-many association to PhoneNumber
@ManyToMany
@JoinColumn(name="customer_ID")
private List<PhoneNumber> phoneNumbers;
