获取无法反序列化异常 - Java,PostgreSQL和QueryDSL

时间:2017-10-10 08:43:39

标签: java postgresql hibernate

在我调用javax.persistence.PersistenceException: org.hibernate.type.SerializationException: could not deserializefindAll()方法时获取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;
        }

    }

0 个答案:

没有答案