Hibernate使用注解
程序员文章站
2022-05-23 22:13:26
...
//类标志 @Entity @Table(name = "TC_CONTACT") public class TContract extends BaseDomain //id主键标志 @Id @GeneratedValue(generator = "identifier", strategy = GenerationType.IDENTITY) @SequenceGenerator(name = "identifier", allocationSize = 1) @Column(name = "ID") //列标示 @Column(name = "link_man_no", nullable = false, insertable = false, updatable = false) @Column(name = "CREATED_ON", unique = false, insertable = false, updatable = false) @Transient private String updateTime; //多对一 @ManyToOne(targetEntity = TactivatableItem.class) @Cascade(value = {CascadeType.PERSIST, CascadeType.MERGE }) @JoinColumn(name = "LINE_ITEM_ID") public TactivatableItem getActivatableItem() { return activatableItem; } //一对多 @OneToMany(targetEntity = TentitlementFeatureDetail.class, fetch = FetchType.EAGER, mappedBy = "feature") @Cascade(value = {CascadeType.DELETE_ORPHAN, CascadeType.SAVE_UPDATE }) public List<TentitlementFeatureDetail> getDetailList() { return detailList; } @OneToMany(fetch = FetchType.LAZY, mappedBy = "tactivatableItem", targetEntity = Tfulfillment.class) @Cascade(value = {CascadeType.SAVE_UPDATE, CascadeType.DELETE_ORPHAN }) @OneToMany(targetEntity = TentitlementFeature.class, fetch = FetchType.LAZY, mappedBy = "activatableItem") @Cascade(value = {CascadeType.DELETE_ORPHAN, CascadeType.SAVE_UPDATE }) //多对多 @ManyToOne(targetEntity = Tproduct.class) @Cascade(value = {CascadeType.PERSIST, CascadeType.MERGE }) @JoinColumn(name = "PRODUCT_ID") @ManyToOne(fetch = FetchType.LAZY, targetEntity = TLogoInfo.class) @NotFound(action = NotFoundAction.IGNORE) @JoinColumn(name = "LOGO_INFO_ID")
上一篇: 仙岛求药 计蒜客 - T1212
下一篇: 【转】JSP去空白行
推荐阅读
-
Hibernate hql 查询指定字段并获取结果集
-
PHP使用empty检查函数返回结果时报Fatal error: Can't use function return value in write context的问题 - 心中的飞梦
-
在webpack中使用eslint配置(详细教程)
-
使用css3背景渐变中的透明度来设置不同颜色的背景渐变_html/css_WEB-ITnose
-
结合PHP使用HTML表单1
-
javascript使用appendChild追加节点实例_javascript技巧
-
使用Perl语言去存取mSQL和MySQL数据库的内容_MySQL
-
Ajax中readyState与status应该怎么使用
-
PHP的惰性加载跟Iterator的使用
-
使用PHP实现密保卡功能实现代码<打包下载直接运行>_PHP