0

Getting a javax.persistence.PersistenceException: org.hibernate.type.SerializationException: could not deserialize exception when I call findAll() or findBySn method.

public interface SoaSnRepository extends JpaRepository<SoaSn, Long>, QueryDslPredicateExecutor<SoaSn> {
public SoaSn findByZone(Zone zone);
public SoaSn findBySn(Integer sn);
public List<SoaSn> findAll();

}

SoaSn class has their attributes:

private Integer id;
private Zone zone;
private Integer sn;

Zone is stored as bytea in the table (using PostgreSQL)

SoaSn Class:

    @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;
        }

    }
Danyal Sandeelo
  • 12,196
  • 10
  • 47
  • 78

0 Answers0