Hello,
First, I point the fact that I'm french and maybe I'll make some mistake in my post.
I'll expose my problem.
I'm currently processing a forum with Spring MVC and Hibernate.
I encounter problems to implement the form where I want to create new threads and the first new post.
My hibernate model look's like this
Code:@Entity @Table(name = "subject") public class Subject implements java.io.Serializable { private int id; private Forum forum; private Users users; private String shortdescription; private String description; private Date startdate; private Date updatedate; private Date enddate; private Set<Post> posts = new HashSet<Post>(0); ... @OneToMany(fetch = FetchType.LAZY, mappedBy = "subject") public Set<Post> getPosts() { return this.posts; } public void setPosts(Set<Post> posts) { this.posts = posts; } }I don't know how to design my form to create simultaneously the subject and the first post.Code:@Entity @Table(name = "post") public class Post implements java.io.Serializable { private int id; private Subject subject; private Users users; private String title; private String body; private Date startdate; private Date enddate; private Date updatedate; ... }
I've start to write the form :
My textatera, here, match to the post and the other fields are for the subject.HTML Code:<sf:form method="post" commandName="post.html" modelAttribute="subject"> <span class="spForm"><label>Titre</label><input type="text" name="shortdescription"/></span> <span class="spForm"><textarea name="body"></textarea></span> <span class="spForm"><button type="submit">Envoyer</button></span> </sf:form>
Is there possible with spring, or must I reference the first post in my subject ?
Thanks for your help
Pierre



Reply With Quote
Thanks
