This is what I have annotated in BookFile set.

@OneToMany(cascade = {CascadeType.PERSIST, CascadeType.MERGE})
@JoinTable(name = "book_file", joinColumns = {...@joincolumn(name="book_id")}, 
                        inverseJoinColumns = {...@joincolumn(name = 
"bookFile_id")})
@LazyCollection(value = LazyCollectionOption.FALSE)
public Set<BookFile> getBookFiles() {
        return bookFiles;
}

Gero


ramzi khlil wrote:
> 
> You may need to specify cascade attribute.
> 
> Ramzi
> 
> 
> 
> On Thu, Nov 5, 2009 at 12:50 PM, gerogut
> <gutierrez.geron...@gmail.com>wrote:
> 
>>
>> Hi, I'm a begginer in this matter so I'm sorry if my questions are
>> stupid.
>>
>> I'm building a webapp to manage the books i have in my office.
>> I have a book class which has the info I need and it has a Set<BookFile>
>> which will store file associated to that info. That is, the actual pdf of
>> the book, examples, etc.
>>
>> 1 - I declared the set with @OnToMany with a @JoinTable and
>> @LazyCollection
>> is that ok? It creates de DB ok and populates it with my sample data.
>> 2- Then I have a booksearch.jsp which allowws me to search through the
>> books
>> and then shows me the list of books in books.jsp
>> 3- If I click on a book it sends me to bookform.jsp which shows me book
>> info
>> in a form an I can update the info.
>> 4- When I click on the "files" button it takes me to the bookfiles.jsp
>> which
>> is the list of files associated to that book, and then comes my PROBLEM,
>> which I dont know how to resolve and maybe t comes from before.
>> 5- when I add a book it adds it to the DB but it does not add the value
>> to
>> the joinTable so the file is not associated to the book. And i can't
>> acces
>> the value of the Book from bookFileFormController...
>>
>> Any suggestions, corrections, comments? THANK YOU.
>> --
>> View this message in context:
>> http://old.nabble.com/Spring-MVC-or-General---Begginer-Question-tp26216556s2369p26216556.html
>> Sent from the AppFuse - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
>> For additional commands, e-mail: users-h...@appfuse.dev.java.net
>>
>>
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Spring-MVC---Begginer-Question-tp26216556s2369p26220378.html
Sent from the AppFuse - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
For additional commands, e-mail: users-h...@appfuse.dev.java.net

Reply via email to