在我调用javax.persistence.PersistenceException: org.hibernate.type.SerializationException: could not deserialize
或findAll()
方法时获取findBySn
例外情况。
public interface SoaSnRepository extends JpaRepository<SoaSn, Long>, QueryDslPredicateExecutor<SoaSn> {
public SoaSn findByZone(Zone zone);
public SoaSn findBySn(Integer sn);
public List<SoaSn> findAll();
}
SoaSn类有其属性:
private Integer id;
private Zone zone;
private Integer sn;
Zone
在表格中存储为bytea
(使用PostgreSQL
)
SoaSn课程:
@Entity
public class SoaSn extends UpdatedAndCreatedByModel implements Serializable {
private Integer id;
private Zone zone;
private Integer sn;
@Id
@SequenceGenerator(name = "soaSnSeq", sequenceName = "soa_sn_seq", allocationSize = 1)
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "soaSnSeq")
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
@Column(nullable = false)
public Zone getZone() {
return zone;
}
public void setZone(Zone zone) {
this.zone = zone;
}
@Column(nullable = false)
public Integer getSn() {
return sn;
}
public void setSn(Integer sn) {
this.sn = sn;
}
}