ORA-00904: 映射问题导致标识符无效
ORA-00904: mapping issue causes invalid identifier
我有一个问题,该问题的名称如下所示。
java.sql.SQLSyntaxErrorException: ORA-00904: "DETAILORDE1_"."BOOK": invalid identifier
意思是不映射Book和DetailOrder class.
我搜索了很多资源来解决这个问题。我尝试了他们的很多选择,但没有任何改变。 pk.book 价值无法从书中感知 class.
我该如何解决?
下面是代码。
图书
@Entity
@Table(name="BOOK",catalog = "JSPPROJECTDATABASE")
public class Book implements Serializable{
...
@OneToMany(mappedBy = "pk.book", cascade=CascadeType.ALL)
private Set<DetailOrder> detailOrders = new HashSet<DetailOrder>();
详细订单
@Entity
@Table(name = "DETAIL_ORDER", catalog = "JSPPROJECTDATABASE")
@AssociationOverrides({
@AssociationOverride(name = "pk.orders",
joinColumns = @JoinColumn(name = "ORDER_ID")),
@AssociationOverride(name = "pk.book",
joinColumns = @JoinColumn(name = "BOOK_ID")) })
public class DetailOrder implements Serializable{
...
@EmbeddedId
public DetailOrderId getPk() {
return pk;
}
public void setPk(DetailOrderId pk) {
this.pk = pk;
}
@Transient
public Book getBook() {
return getPk().getBook();
}
public void setBook(Book book) {
getPk().setBook(book);
}
@Transient
public Orders getOrders() {
return getPk().getOrders();
}
public void setOrders(Orders orders) {
getPk().setOrders(orders);
}
DetailOrderId
@Embeddable
public class DetailOrderId implements Serializable{
@ManyToOne(cascade=CascadeType.ALL)
@JoinColumn(name = "BOOK_ID")
private Book book;
@ManyToOne(cascade=CascadeType.ALL)
@JoinColumn(name = "ORDER_ID")
private Orders orders;
public Book getBook() {
return book;
}
public void setBook(Book book) {
this.book = book;
}
public Orders getOrders() {
return orders;
}
public void setOrders(Orders orders) {
this.orders = orders;
}
我在没有使用复合 id 的情况下解决了这个问题。
我有一个问题,该问题的名称如下所示。
java.sql.SQLSyntaxErrorException: ORA-00904: "DETAILORDE1_"."BOOK": invalid identifier
意思是不映射Book和DetailOrder class.
我搜索了很多资源来解决这个问题。我尝试了他们的很多选择,但没有任何改变。 pk.book 价值无法从书中感知 class.
我该如何解决?
下面是代码。
图书
@Entity
@Table(name="BOOK",catalog = "JSPPROJECTDATABASE")
public class Book implements Serializable{
...
@OneToMany(mappedBy = "pk.book", cascade=CascadeType.ALL)
private Set<DetailOrder> detailOrders = new HashSet<DetailOrder>();
详细订单
@Entity
@Table(name = "DETAIL_ORDER", catalog = "JSPPROJECTDATABASE")
@AssociationOverrides({
@AssociationOverride(name = "pk.orders",
joinColumns = @JoinColumn(name = "ORDER_ID")),
@AssociationOverride(name = "pk.book",
joinColumns = @JoinColumn(name = "BOOK_ID")) })
public class DetailOrder implements Serializable{
...
@EmbeddedId
public DetailOrderId getPk() {
return pk;
}
public void setPk(DetailOrderId pk) {
this.pk = pk;
}
@Transient
public Book getBook() {
return getPk().getBook();
}
public void setBook(Book book) {
getPk().setBook(book);
}
@Transient
public Orders getOrders() {
return getPk().getOrders();
}
public void setOrders(Orders orders) {
getPk().setOrders(orders);
}
DetailOrderId
@Embeddable
public class DetailOrderId implements Serializable{
@ManyToOne(cascade=CascadeType.ALL)
@JoinColumn(name = "BOOK_ID")
private Book book;
@ManyToOne(cascade=CascadeType.ALL)
@JoinColumn(name = "ORDER_ID")
private Orders orders;
public Book getBook() {
return book;
}
public void setBook(Book book) {
this.book = book;
}
public Orders getOrders() {
return orders;
}
public void setOrders(Orders orders) {
this.orders = orders;
}
我在没有使用复合 id 的情况下解决了这个问题。