" I am doing a long overdue upgrade from 3.6.5 to 5.1.
I \r\n\r\nI have a mapping from a class Lead to itself as follows:
\r\n\r\n\r\n {code:java} \r\n @Entity \r\n @Table(name= \ "lead \ ", uniqueConstraints = { }) public \r\npublic class Lead implements Serializable {
\r\n\r\n private int leadid; \r\n \r\n private Set<Lead> duplicateLeadChildren; \r\n private Lead duplicateLeadParent;
\r\n\r\n public Lead () { \r\n\t\r\n } \r\n \r\n @Id \r\n @GeneratedValue(strategy=GenerationType.IDENTITY) \r\n @Column(name= \ "leadid \ ", unique=true, nullable=false, insertable=true, updatable=true) \r\n public int getLeadid() { \r\n return this.leadid; \r\n } \r\n public void setLeadid(int leadid) { \r\n this.leadid = leadid; \r\n }
\r\n\r\n // More fields
\r\n\r\n /** \r\n * Returns a set of leads that has been marked as duplicates of this lead. \r\n * @return \r\n */ \r\n @OneToMany(fetch=FetchType.LAZY) \r\n @JoinTable(name= \ "leadduplicate \ " \r\n , joinColumns={@JoinColumn(name= \ "parentleadid \ ")} \r\n , inverseJoinColumns={@JoinColumn(name= \ "childleadid \ ")}) \r\n @NotFound(action=NotFoundAction.IGNORE) \r\n public Set<Lead> getDuplicateLeadChildren(){ \r\n return duplicateLeadChildren; \r\n }
\r\n\r\n public void setDuplicateLeadChildren(Set<Lead> duplicateLeadChildren) { \r\n this.duplicateLeadChildren = duplicateLeadChildren; \r\n }
\r\n\r\n /** \r\n * Returns a lead if this lead has been marked as a duplicate. \r\n * \r\n * The returned lead is the lead that should be used as the main lead in all future contact with the company. \r\n * @return \r\n */ \r\n @ManyToOne(fetch=FetchType.LAZY) \r\n @JoinTable(name= \ "leadduplicate \ " \r\n , joinColumns={@JoinColumn(name= \ "childleadid \ ")} \r\n , inverseJoinColumns={@JoinColumn(name= \ "parentleadid \ ")}) \r\n @NotFound(action=NotFoundAction.IGNORE) \r\n public Lead getDuplicateLeadParent(){ \r\n return duplicateLeadParent; \r\n }
\r\n\r\n public void setDuplicateLeadParent(Lead duplicateLeadParent) { \r\n this.duplicateLeadParent = duplicateLeadParent; \r\n } \r\n } \r\n {code}
This \r\n\r\nThis has worked for years. After upgrading to 5.1.14.Final or 5.2.17.Final, if I create a Lead and try to save it, I get this error.
\r\n\r\n\r\n {code:java} final \r\nfinal Lead lead = new Lead(); \r\n // Removed setting some other fields removed from the class above session \r\nsession .saveOrUpdate(lead); \r\n {code}
\r\n\r\n {code:java} Caused \r\nCaused by: org.hibernate.PropertyValueException: not-null property references a null or transient value : se.telavox.tbone.dao.base.Lead.duplicateLeadParent \r\n {code}
It sound \r\n\r\nIt sounds kind of similar to the issue here: https://hibernate.atlassian.net/browse/HHH-11596 but using a version later than the fix version for that issue (5.2.10) doesn't help. " |
|