Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Entity
- @Table(name="lead", uniqueConstraints = { })
- public class Lead implements Serializable {
- private int leadid;
- // More fields
- private Set<Lead> duplicateLeadChildren;
- private Lead duplicateLeadParent;
- @Id
- @GeneratedValue(strategy=GenerationType.IDENTITY)
- @Column(name="leadid", unique=true, nullable=false, insertable=true, updatable=true)
- public int getLeadid() {
- return this.leadid;
- }
- public void setLeadid(int leadid) {
- this.leadid = leadid;
- }
- // More setters and getters
- /**
- * Returns a set of leads that has been marked as duplicates of this lead.
- * @return
- */
- @OneToMany(fetch=FetchType.LAZY)
- @JoinTable(name="leadduplicate"
- , joinColumns={@JoinColumn(name="parentleadid")}
- , inverseJoinColumns={@JoinColumn(name="childleadid")})
- @NotFound(action=NotFoundAction.IGNORE)
- public Set<Lead> getDuplicateLeadChildren(){
- return duplicateLeadChildren;
- }
- public void setDuplicateLeadChildren(Set<Lead> duplicateLeadChildren) {
- this.duplicateLeadChildren = duplicateLeadChildren;
- }
- /**
- * Returns a lead if this lead has been marked as a duplicate.
- *
- * The returned lead is the lead that should be used as the main lead in all future contact with the company.
- * @return
- */
- @ManyToOne(fetch=FetchType.LAZY)
- @JoinTable(name="leadduplicate"
- , joinColumns={@JoinColumn(name="childleadid")}
- , inverseJoinColumns={@JoinColumn(name="parentleadid")})
- @NotFound(action=NotFoundAction.IGNORE)
- public Lead getDuplicateLeadParent(){
- return duplicateLeadParent;
- }
- public void setDuplicateLeadParent(Lead duplicateLeadParent) {
- this.duplicateLeadParent = duplicateLeadParent;
- }
- }
- final Lead lead = new Lead();
- // Removed setting some other fields removed from the class above
- session.saveOrUpdate(lead);
- Caused by: org.hibernate.PropertyValueException: not-null property references a null or transient value : se.telavox.tbone.dao.base.Lead.duplicateLeadParent
Add Comment
Please, Sign In to add comment