JPA Bidirectional OneToMany and ManyToOne?
Posted
by
PhoenixJon
on Stack Overflow
See other posts from Stack Overflow
or by PhoenixJon
Published on 2011-11-29T20:08:01Z
Indexed on
2011/11/30
1:50 UTC
Read the original article
Hit count: 195
I'm using Oracle JDeveloper 11g Release 2.
I created two tables A and B using SQL developer.
Table A has a FK to table B. Using the Entities from Tables function, I created two JPA files from it.
A has @ManyToOne annotation on FK.
And also B has @OneToMany annotation to A. I don't want this.
Can I remove this @OneToMany annotation automatically?
public class A implements Serializable {
...
@ManyToOne
@JoinColumn(name = "FIELD_B")
private B b;
...
}
public class B implements Serializable {
...
@OneToMany(mappedBy = "B")
private List<A> assetList;
...
}
I don't need @OneToMany mapping.
© Stack Overflow or respective owner