JPA - disable inheritance on Subclass

My Class "Resource_Image" is a subclass of Resource and all things work as expected, but in my Database both tables containing the column "STRUCTURE". Why? Using setRs on an Resource_Image instance is setting Resource_Structure on superclass, but why i'm having the column "STRUCTURE" on Table "res_images" too, it doesn't make sense? See the Code at the bottom. Any Ideas? @Entity @Table(name="res") @Inheritance(strategy=InheritanceType.JOINED) public class Resource { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "ID") private Long id; @JoinColumn(name = "STRUCTURE",nullable=false) private Resource_Structure rs; //getter and setter for rs public final void setRs(Resource_Structure rs) { = rs; } //... } @Entity @Table(name="res_images") public class Resource_Image extends Resource { @Column(name = "WIDTH",nullable=false) private int width; @Column(name = "HEIGHT",nullable=false) private int height; //NO getter and setter for rs }

以上就是JPA - disable inheritance on Subclass的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准