Hibernate使用注解

//类标志
@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")

你可能感兴趣的:(Hibernate)