I have two entities, and when i use @ManyToOne annotation, i'm getting an error saying "Target Entity is not defined"
.
I'm just following a tutorial and i can't seem to find what i did wrong.
@Entity
@Table(name="BEO_TABLE")
public class BeoBean {
@Id
@GeneratedValue
@Column(name="Beo_Id")
private int beoId;
//other variables
@OneToMany(mappedBy="beo")
private List<EventsBean> listOfEvents = new ArrayList<EventsBean>();
//getters and setters
}
AND
@Entity
@Table(name="EVENTS_TABLE")
public class EventsBean {
//other variables
@ManyToOne //error here
@JoinColumn(name="Beo_Id")
private BeoBean beo;
//getters and setters
}
Thanks for your help
This error has nothing to do with your application. It works fine but the error is in Eclipse.
To remove this (and other JPA) error message simply disable the JPA validation under Window -> Preferences -> Validation
and here remove the checks from JPA Validator
.
Generally most applications can be developed without any validators because bigger projects' validation slows down compiling in eclipse way too much. In this case click Disable all
in the same window below the table of validators.
Fix your persistence unit in eclipse. Add BeoBean to the PU. You should be sorted
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With