No operations allowed after connection closed连接异常的解决

使用注解

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "dict_type", nullable = false )
@Column( name = "dict_type"  , length = 100  )
public String getDictType() {
   return  dictType;
}

public void setDictType(String dictType) {
   this.dictType = dictType;
}

发现关联字段 dict_type 重复

导致直接编译失败

解决办法

 

 

 

 

 

 

使用

@Transient

声明为数据库映射 解决

 

 

@Transient
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "dict_type", nullable = false )
public SysDictType getSysDictType() {
   return  this.SysDictType;
}

你可能感兴趣的:(No operations allowed after connection closed连接异常的解决)