Hibernate会话以大量关闭

时间:2017-10-16 14:19:10

标签: spring hibernate jpa

我尝试使用以下实体从链接到父表的表中检索数据:

 %do i=1 %to %sysfunc(countw(&list,|));
   %let word=%scan(&list,&i,|);
   ...
 %end;

和女儿实体:

Entity
@Table(name = "REF_BONJOUR_UNITE")
@NamedQuery(name = "UniteEntity.findAll", query = "SELECT u FROM UniteEntity u")
public class UniteEntity implements Serializable {
    private static final long serialVersionUID = 1L;
@Id
@Column(name = "CODE_UNITE")
private String codeUnite;

// bi-directional many-to-one association to Insee
    @OneToMany(mappedBy = "refBonjourUnite", fetch = FetchType.LAZY, cascade =  CascadeType.MERGE )
    private List<Insee> refBonjourInsees;

当我尝试使用大量数据访问此列表时,我得到的是懒得初始化角色集合,这里确切地说:

@Entity
@Table(name = "REF_BONJOUR_INSEE")
@NamedQuery(name = "Insee.findAll", query = "SELECT i FROM Insee i")
public class Insee implements Serializable {
    private static final long serialVersionUID = 1L;

@EmbeddedId
private InseePK id;

@Temporal(TemporalType.DATE)
@Column(name = "DATE_FIN_INSEE_GEO")
@IsOracleDate
private Date dateFinInseeGeo;

private String tylemt;

// bi-directional many-to-one association to UniteEntity
@ManyToOne
@JoinColumn(name = "CODE_UNITE_FK", insertable = false, updatable = false)
private UniteEntity refBonjourUnite;

0 个答案:

没有答案