package com.nmt.nscvs.domain.registration;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import com.nmt.nscvs.domain.ref.SiRefRole;
/**
* The persistent class for the SI_REGISTRATION database table.
*
*/
@Entity()
@Table(name="SI_REGISTRATION")
public class SiRegistration implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="regId")
@SequenceGenerator(name="regId", sequenceName="SI_SEQ_REGISTRATION", allocationSize = 1)
@Column(name="REGISTRATION_ID", unique=true, nullable=false, precision=10)
private Long registrationId;
@Column(name="MESSAGE_DELIVERY_EMAIL_ADDRESS", length=255)
private String messageDeliveryEmailAddress;
//bi-directional many-to-many association to SiRefRole
@ManyToMany(fetch=FetchType.LAZY, cascade=CascadeType.ALL)
@JoinTable(
name="SI_REGISTRATION_ROLE"
, joinColumns={//连接列
@JoinColumn(name="REGISTRATION_ID", referencedColumnName="REGISTRATION_ID", nullable=true)
}
, inverseJoinColumns={ //反向连接列
@JoinColumn(name="ROLE_CODE", referencedColumnName="ROLE_CODE", nullable=true)
}
)
private List<SiRefRole> siRefRoles;
@OneToMany(mappedBy="siRegistration", fetch=FetchType.LAZY, cascade=CascadeType.ALL)
private List<SiRegistrationCertificate> siRegistrationCertificates;
}
JPA实体类表关系示例
最新推荐文章于 2022-07-16 17:04:49 发布