我在eclipse中使用JPA功能“从实体生成表”时出现问题。 我设法为我的项目完成所有的ORM映射,但只有一个导致我陷入困境。使用JPA工具的对象关系映射:从实体生成表功能
控制台这样说:
内部异常:java.sql.SQLSyntaxErrorException: 'OFFER_ID' 不是表或VTI '注释' 一栏。 错误代码:-1
这是表应该怎么看起来像一个形象:
-One报价有很多评论
-One评论属于one Offer ...
这是实体如何看起来像: 实体评论:
@Entity
public class Comment {
// Attributes
@Id
@GeneratedValue
@Column(nullable = false)
private Long id;
...
@ManyToOne
@JoinColumn(name = "OFFER_ID", nullable = false)
private Offer offer;// One comment must belong to one offer
...Getters and setters
实体发售:
@Entity
public class Offer {
//...Other attributes
@OneToMany(mappedBy = "offer")
private List<Coupon> coupons;//One offer can have many coupons
@OneToMany(mappedBy = "offer")
private List<Comment> comments; //One offer can have many comments
... getters and setters
在故意类要约我粘贴与其他类的类报价有关系的所谓优惠券,正如你所看到的,它与提供课堂评论的优惠券完全一样。
那么问题是什么?
为什么一个关系被映射和其他没有?
为什么数据库COMMENT中新创建的表没有名为OFFER_ID的列?
我该如何解决?
优惠已经有一个ID。但我会尝试与列名 – sfrj 2011-04-06 14:32:40
没有它没有工作,问题必须在其他地方 – sfrj 2011-04-06 15:00:50