小编Roo*_*ooh的帖子

JPA 2.0 Provider Hibernate

我有一个非常奇怪的问题我们正在使用基于hibernate注释的jpa 2.0通过JPA DDL生成的数据库是真的而MySQL作为数据库;

我将提供一些参考课程,然后我的问题.

@MappedSuperclass
public abstract class Common implements serializable{
 @Id
 @GeneratedValue(strategy = GenerationType.AUTO)
 @Column(name = "id", updatable = false)
 private Long id;

 @ManyToOne
 @JoinColumn
 private Address address;
        //with all getter and setters
        //as well equal and hashCode

}

@Entity
public class Parent extends Common{
         private String name;
         @OneToMany(cascade = {CascadeType.MERGE,CascadeType.PERSIST}, mappedBy = "parent") 
         private List<Child> child;
         //setters and rest of class
}

@Entity
public class Child extends Common{
//some properties with getter/setters
}

@Entity
public class Address implements …
Run Code Online (Sandbox Code Playgroud)

java hibernate jpa java-ee jpa-2.0

6
推荐指数
1
解决办法
921
查看次数

标签 统计

hibernate ×1

java ×1

java-ee ×1

jpa ×1

jpa-2.0 ×1