I'm getting org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing in the following context: Comment. I assume because of the mappedBy? Not sure how to proceed to make it work, tried a few variations
{{{
public class Post{
@OneToMany(cascade=

{ CascadeType.REMOVE, CascadeType.MERGE, CascadeType.PERSIST }

, orphanRemoval=false, mappedBy="post", fetch=FetchType.LAZY)
@LazyCollection(LazyCollectionOption.EXTRA)
@OrderColumn(name="idx")
public List<Comment> getComments()

{ [...] }
}

public class Comment{

@ManyToOne(fetch=FetchType.LAZY,optional=true)
@JoinColumn(name="FK_PostId",nullable=true,insertable=true,updatable=false)
public Post getPost(){[...] }

}

}}}
{{

{ Comment comment = new Comment(); comment.setTxt("comment"); comment.setPost(post); int size = post.getComments().size(); post.getComments().add(comment); post = dao.save(post); dao.flush(); comment = post.getComments().get(size); }}

}

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira