I a having problems getting the sample data to be inserted when i run teh hibernate3:hbm2ddl command - it is giving me the following error
"[INFO] Error executing database operation: CLEAN_INSERT Embedded error: Error casting value for table 'notes' and column 'ParentNotesID' " I am looking to create the following setup : Main Notes (has set) noteitem1 - belongs to Main Notes noteitem2 - belongs to Main Notes noteitem3 - belong to Main Notes MiniNotes - this belongs to Main Notes (has set) noteitem1 - belongs to MiniNotes noteitem2 - belongs to MiniNotes noteitem3 - belongs to MiniNotes (so notes contains a set of noteitems and/or a folder that contains set of items) the sample data looks like <table name='notes'> <column>NotesID</column> <column>title</column> <column>ParentNotesID</column> </table> and the code: @Entity @Table(name = "Notes", uniqueConstraints = @UniqueConstraint(columnNames = {"title", "ParentNotesID"}) ) public class Notes extends BaseObject implements Serializable { protected Long NotesID; protected String title; protected Set<Notes> childNotes = new HashSet<Notes>(); private Notes parentNotes; public Notes() {} @Id @GeneratedValue(strategy = GenerationType.AUTO) public Long getNotesID() { return NotesID; } @Column(name = "title") public String getTitle() { return title; } @OneToMany(mappedBy = "parentNotes", cascade = {CascadeType.PERSIST, CascadeType.MERGE} ) public Set<Notes> getChildNotes() { return childNotes; } public void addChildNote(Notes childNote){ if (childNote == null) throw new IllegalArgumentException("Null child Notes!"); if (childNote.getParentNotes() != null) childNote.getParentNotes().getChildNotes().remove(childNote); childNote.setParentNotes(parentNotes); childNotes.add(childNote); } public void removeChildNote(Notes childNote) { if (childNote == null) throw new IllegalArgumentException("Null child Notes!"); childNote.setParentNotes(null); childNotes.remove(childNote); } private void setChildNotes(Set<Notes> childNotes) { this.childNotes = childNotes; } @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "ParentNotesID", nullable = true) @org.hibernate.annotations.ForeignKey(name = "FKParentNotesID") public Notes getParentNotes() { return parentNotes; } private void setParentNotes(Notes parentNotes) { this.parentNotes = parentNotes; } can someone please direct me in the right direction - am I approaching this the wrong way? thankyou kace -- View this message in context: http://www.nabble.com/self-referencing-OneToMany-Issue-tf3402500s2369.html#a9475636 Sent from the AppFuse - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]