Spring MVC - Begginer Question

18 messages Options
Embed this post
Permalink
gerogut

Spring MVC - Begginer Question

Reply Threaded More More options
Print post
Permalink
(This post was updated on )
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.
ramzi khlil

Re: Spring MVC or General - Begginer Question

Reply Threaded More More options
Print post
Permalink
You may need to specify cascade attribute.
 
Ramzi



On Thu, Nov 5, 2009 at 12:50 PM, gerogut <[hidden email]> 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: [hidden email]
For additional commands, e-mail: [hidden email]


gerogut

Re: Spring MVC or General - Begginer Question

Reply Threaded More More options
Print post
Permalink
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.geronimo@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-unsubscribe@appfuse.dev.java.net
> For additional commands, e-mail: users-help@appfuse.dev.java.net
>
>
ramzi khlil

Re: Spring MVC or General - Begginer Question

Reply Threaded More More options
Print post
Permalink
Can you describe the workflow.
How do you add BookFile to Book object ?
 
Ramzi


 
On Thu, Nov 5, 2009 at 2:57 PM, gerogut <[hidden email]> wrote:

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
> <[hidden email]>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: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>
>
>

--
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: [hidden email]
For additional commands, e-mail: [hidden email]


gerogut

Re: Spring MVC or General - Begginer Question

Reply Threaded More More options
Print post
Permalink

Can you describe the workflow.
How do you add BookFile to Book object ?

Workflow:
1. Books are loaded, the controller is BookController and BookManager gets all books. (books.jsp)

2. I select a book and BookForm is loaded (with book info), controller is BookFormController, command class is Book. (bookform.jsp)

3. I click de button "Files" and BookFileList is loaded, the controller is BookFileController and there bookManager gets the book and then the set of bookFiles which is returned as:

return new ModelAndView().addObject("bookFileList",bookManager.get(book.getId()).getBookFiles());

so the list of files is displayed. (bookfiles.jsp)

4. When I click on a file, bookFileForm is displayed, the controller is BookFileFormController and it has a different manager wich is BookFileManager.(bookfileform.jsp) Here it's the problem, I can't get to associate the file to the book because I don't know how to get the book without an id. In this controller I only have the id of the bookFile. So, answering you second question, I can't add BookFile to the Book object.

Gero

ramzi khlil wrote:
Can you describe the workflow.
How do you add BookFile to Book object ?

Ramzi



On Thu, Nov 5, 2009 at 2:57 PM, gerogut <gerogut@yahoo.com> wrote:

>
> 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.geronimo@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-unsubscribe@appfuse.dev.java.net
> >> For additional commands, e-mail: users-help@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-unsubscribe@appfuse.dev.java.net
> For additional commands, e-mail: users-help@appfuse.dev.java.net
>
>
[hidden email]
ramzi khlil

Re: Spring MVC or General - Begginer Question

Reply Threaded More More options
Print post
Permalink
You can simply add your book object to the ModelAndView.
Use a Map to include the book.
 
Map objects = new HashMap();
objects.put("ParentBook", book);
objects.put("bookFileList",bookManager.get(book.getId()).getBookFiles());
ModelAndView().addObject("bookFileList", objects);
 

 
On Thu, Nov 5, 2009 at 3:54 PM, gerogut <[hidden email]> wrote:


Can you describe the workflow.
How do you add BookFile to Book object ?

Workflow:
1. Books are loaded, the controller is BookController and BookManager gets
all books. (books.jsp)

2. I select a book and BookForm is loaded (with book info), controller is
BookFormController, command class is Book. (bookform.jsp)

3. I click de button "Files" and BookFileList is loaded, the controller is
BookFileController and there bookManager gets the book and then the set of
bookFiles which is returned as:

return new
ModelAndView().addObject("bookFileList",bookManager.get(book.getId()).getBookFiles());

so the list of files is displayed. (bookfiles.jsp)

4. When I click on a file, bookFileForm is displayed, the controller is
BookFileFormController and it has a different manager wich is
BookFileManager.(bookfileform.jsp) Here it's the problem, I can't get to
associate the file to the book because I don't know how to get the book
without an id. In this controller I only have the id of the bookFile. So,
answering you second question, I can't add BookFile to the Book object.

Gero


ramzi khlil wrote:
>
> Can you describe the workflow.
> How do you add BookFile to Book object ?
>
> Ramzi
>
>
>
> On Thu, Nov 5, 2009 at 2:57 PM, gerogut <[hidden email]> wrote:
>
>>
>> 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
>> > <[hidden email]>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: [hidden email]
>> >> For additional commands, e-mail: [hidden email]
>> >>
>> >>
>> >
>> >
>>
>> --
>> 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: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>
>
>
show [hidden email] as gerogut
--
View this message in context: http://old.nabble.com/Spring-MVC---Begginer-Question-tp26216556s2369p26222035.html
Sent from the AppFuse - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]


ramzi khlil

Re: Spring MVC or General - Begginer Question

Reply Threaded More More options
Print post
Permalink
Sorry I misunderstand you requirement,
 
A simple solution consists of creating a hidden field in BookFileList.jsp that holds the id of the book.
 
Ramzi

On Thu, Nov 5, 2009 at 4:13 PM, ramzi khlil <[hidden email]> wrote:
You can simply add your book object to the ModelAndView.
Use a Map to include the book.
 
Map objects = new HashMap();
objects.put("ParentBook", book);
objects.put("bookFileList",bookManager.get(book.getId()).getBookFiles());
ModelAndView().addObject("bookFileList", objects);
 

 
On Thu, Nov 5, 2009 at 3:54 PM, gerogut <[hidden email]> wrote:


Can you describe the workflow.
How do you add BookFile to Book object ?

Workflow:
1. Books are loaded, the controller is BookController and BookManager gets
all books. (books.jsp)

2. I select a book and BookForm is loaded (with book info), controller is
BookFormController, command class is Book. (bookform.jsp)

3. I click de button "Files" and BookFileList is loaded, the controller is
BookFileController and there bookManager gets the book and then the set of
bookFiles which is returned as:

return new
ModelAndView().addObject("bookFileList",bookManager.get(book.getId()).getBookFiles());

so the list of files is displayed. (bookfiles.jsp)

4. When I click on a file, bookFileForm is displayed, the controller is
BookFileFormController and it has a different manager wich is
BookFileManager.(bookfileform.jsp) Here it's the problem, I can't get to
associate the file to the book because I don't know how to get the book
without an id. In this controller I only have the id of the bookFile. So,
answering you second question, I can't add BookFile to the Book object.

Gero


ramzi khlil wrote:
>
> Can you describe the workflow.
> How do you add BookFile to Book object ?
>
> Ramzi
>
>
>
> On Thu, Nov 5, 2009 at 2:57 PM, gerogut <[hidden email]> wrote:
>
>>
>> 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
>> > <[hidden email]>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: [hidden email]
>> >> For additional commands, e-mail: [hidden email]
>> >>
>> >>
>> >
>> >
>>
>> --
>> 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: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>
>
>
show [hidden email] as gerogut
--
View this message in context: http://old.nabble.com/Spring-MVC---Begginer-Question-tp26216556s2369p26222035.html
Sent from the AppFuse - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]



oskarher

Hibernate collections

Reply Threaded More More options
Print post
Permalink
In reply to this post by ramzi khlil
Some javascript/style in this post has been disabled (why?)

Hi, sorry if this list is not the correct place to ask this, but when I want to update a collection (insert or remove an item) hibernate first remove all items from database and then insert the items in the collection, I don't understand why.

Someone knows something about this?

Thanks a lot!

Dale Newfield

Re: Hibernate collections

Reply Threaded More More options
Print post
Permalink
On Thu, Nov 5, 2009 at 4:29 PM, Oscar Rodriguez
<[hidden email]> wrote:
> Hi, sorry if this list is not the correct place to ask this, but when I want
> to update a collection (insert or remove an item) hibernate first remove all
> items from database and then insert the items in the collection, I don't
> understand why.

Depends on how you update that collection.  If you're replacing the
List/Set/etc. with a new List/Set/etc. it doesn't have much choice.
If you take the one with which your object was populated and call
.add(), .remove(), etc on it there's a chance it can be smarter.

-Dale

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

oskarher

Re: Hibernate collections

Reply Threaded More More options
Print post
Permalink
I just doing this:

ParentObj parent = dao.get(ParentObj.class, id);

ChildObj child = new ChildObj();
child.setId(childId);

parent.getChildCollection().remove(child);

dao.save(parent);

Thanks!

----- Original Message -----
From: "Dale Newfield" <[hidden email]>
To: <[hidden email]>
Sent: Thursday, November 05, 2009 6:38 PM
Subject: Re: [appfuse-user] Hibernate collections


On Thu, Nov 5, 2009 at 4:29 PM, Oscar Rodriguez
<[hidden email]> wrote:
> Hi, sorry if this list is not the correct place to ask this, but when I
> want
> to update a collection (insert or remove an item) hibernate first remove
> all
> items from database and then insert the items in the collection, I don't
> understand why.

Depends on how you update that collection.  If you're replacing the
List/Set/etc. with a new List/Set/etc. it doesn't have much choice.
If you take the one with which your object was populated and call
.add(), .remove(), etc on it there's a chance it can be smarter.

-Dale

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]


E-mail clasificado por el Idenfificador de Spam Inteligente.
Para modificar la categoría clasificada acceda a su webmail

Este mensaje ha sido verificado por el E-mail Protegido.
Antivirus actualizado en 05/11/2009 / Versión: 0.95.2/9994



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

ramzi khlil

Re: Hibernate collections

Reply Threaded More More options
Print post
Permalink
You are creating an new object.
Try to get a reference to the object from the list using its object and then run remove(yourobject).
 
Ramzi

On Thu, Nov 5, 2009 at 4:46 PM, Oscar Rodriguez <[hidden email]> wrote:
I just doing this:

ParentObj parent = dao.get(ParentObj.class, id);

ChildObj child = new ChildObj();
child.setId(childId);

parent.getChildCollection().remove(child);

dao.save(parent);

Thanks!

----- Original Message ----- From: "Dale Newfield" <[hidden email]>
To: <[hidden email]>
Sent: Thursday, November 05, 2009 6:38 PM
Subject: Re: [appfuse-user] Hibernate collections



On Thu, Nov 5, 2009 at 4:29 PM, Oscar Rodriguez
<[hidden email]> wrote:
Hi, sorry if this list is not the correct place to ask this, but when I want
to update a collection (insert or remove an item) hibernate first remove all
items from database and then insert the items in the collection, I don't
understand why.

Depends on how you update that collection.  If you're replacing the
List/Set/etc. with a new List/Set/etc. it doesn't have much choice.
If you take the one with which your object was populated and call
.add(), .remove(), etc on it there's a chance it can be smarter.

-Dale

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]


E-mail clasificado por el Idenfificador de Spam Inteligente.
Para modificar la categoría clasificada acceda a su webmail

Este mensaje ha sido verificado por el E-mail Protegido.
Antivirus actualizado en 05/11/2009 / Versión: 0.95.2/9994




---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]


Wojciech Wąsowicz

Re: Spring MVC or General - Begginer Question

Reply Threaded More More options
Print post
Permalink
In reply to this post by gerogut
2009/11/5 gerogut <[hidden email]>:
>
>
> 4. When I click on a file, bookFileForm is displayed, the controller is
> BookFileFormController and it has a different manager wich is
> BookFileManager.(bookfileform.jsp) Here it's the problem, I can't get to
> associate the file to the book because I don't know how to get the book
> without an id. In this controller I only have the id of the bookFile. So,
> answering you second question, I can't add BookFile to the Book object.
>

Maybe you need to add to BookFileController the BookManager bean,
just the same way as BookFileManager is inserted ..

Then you can get Book from BookManager .. just need book.id from
request or bookFile ..

regards
Wojtek

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

oskarher

Re: Hibernate collections

Reply Threaded More More options
Print post
Permalink
In reply to this post by ramzi khlil
Some javascript/style in this post has been disabled (why?)
I try, but always hibernate executes "delete all" first.
 
Thanks anyway.
----- Original Message -----
Sent: Thursday, November 05, 2009 6:48 PM
Subject: Re: [appfuse-user] Hibernate collections

You are creating an new object.
Try to get a reference to the object from the list using its object and then run remove(yourobject).
 
Ramzi

On Thu, Nov 5, 2009 at 4:46 PM, Oscar Rodriguez <[hidden email]> wrote:
I just doing this:

ParentObj parent = dao.get(ParentObj.class, id);

ChildObj child = new ChildObj();
child.setId(childId);

parent.getChildCollection().remove(child);

dao.save(parent);

Thanks!

----- Original Message ----- From: "Dale Newfield" <[hidden email]>
To: <[hidden email]>
Sent: Thursday, November 05, 2009 6:38 PM
Subject: Re: [appfuse-user] Hibernate collections



On Thu, Nov 5, 2009 at 4:29 PM, Oscar Rodriguez
<[hidden email]> wrote:
Hi, sorry if this list is not the correct place to ask this, but when I want
to update a collection (insert or remove an item) hibernate first remove all
items from database and then insert the items in the collection, I don't
understand why.

Depends on how you update that collection.  If you're replacing the
List/Set/etc. with a new List/Set/etc. it doesn't have much choice.
If you take the one with which your object was populated and call
.add(), .remove(), etc on it there's a chance it can be smarter.

-Dale

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]


E-mail clasificado por el Idenfificador de Spam Inteligente.
Para modificar la categoría clasificada acceda a su webmail

Este mensaje ha sido verificado por el E-mail Protegido.
Antivirus actualizado en 05/11/2009 / Versión: 0.95.2/9994




---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]



E-mail clasificado por el Idenfificador de Spam Inteligente. Para modificar la categoría clasificada acceda a su webmail


Este mensaje ha sido verificado por el E-mail Protegido. Antivirus actualizado en 05/11/2009 / Versión: 0.95.2/9994

gerogut

Re: Spring MVC or General - Begginer Question

Reply Threaded More More options
Print post
Permalink
In reply to this post by ramzi khlil
But I have the problem in the next step, when I go from BookFileList.jsp (actually called bookfiles.jsp which displays a list of files) to BookFileForm.jsp.

In BookFileList I have the list of bookFiles of a certain book, if I click on a line of the table(file) it takes me to bookfileform.html?id=# and there I can change the info of the current bookFile and even change the file. The id there is a bookFile id.

BUT if I click on the button ADD from BookFileList it takes me to bookfileform.html and it doesn't associate that new file to the current book.

Where do I have to add the bookFile? as soon as I click on add on bookfilelist or when I save changes on book file form?

Do you need a little bit of code to help? I don't post it because it is quite long.

Gero

ramzi khlil wrote:
Sorry I misunderstand you requirement,

A simple solution consists of creating a hidden field in BookFileList.jsp
that holds the id of the book.

Ramzi

On Thu, Nov 5, 2009 at 4:13 PM, ramzi khlil <ramzi.atvent@gmail.com> wrote:

> You can simply add your book object to the ModelAndView.
> Use a Map to include the book.
>
> Map objects = new HashMap();
> objects.put("ParentBook", book);
> objects.put("bookFileList",bookManager.get(book.getId()).getBookFiles());
> ModelAndView().addObject("bookFileList", objects);
>
>
>
> On Thu, Nov 5, 2009 at 3:54 PM, gerogut <gerogut@yahoo.com> wrote:
>
>>
>>
>> Can you describe the workflow.
>> How do you add BookFile to Book object ?
>>
>> Workflow:
>> 1. Books are loaded, the controller is BookController and BookManager gets
>> all books. (books.jsp)
>>
>> 2. I select a book and BookForm is loaded (with book info), controller is
>> BookFormController, command class is Book. (bookform.jsp)
>>
>> 3. I click de button "Files" and BookFileList is loaded, the controller is
>> BookFileController and there bookManager gets the book and then the set of
>> bookFiles which is returned as:
>>
>> return new
>>
>> ModelAndView().addObject("bookFileList",bookManager.get(book.getId()).getBookFiles());
>>
>> so the list of files is displayed. (bookfiles.jsp)
>>
>> 4. When I click on a file, bookFileForm is displayed, the controller is
>> BookFileFormController and it has a different manager wich is
>> BookFileManager.(bookfileform.jsp) Here it's the problem, I can't get to
>> associate the file to the book because I don't know how to get the book
>> without an id. In this controller I only have the id of the bookFile. So,
>> answering you second question, I can't add BookFile to the Book object.
>>
>> Gero
>>
>>
>> ramzi khlil wrote:
>> >
>> > Can you describe the workflow.
>> > How do you add BookFile to Book object ?
>> >
>> > Ramzi
>> >
>> >
>> >
>> > On Thu, Nov 5, 2009 at 2:57 PM, gerogut <gerogut@yahoo.com> wrote:
>> >
>> >>
>> >> 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.geronimo@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-unsubscribe@appfuse.dev.java.net
>> >> >> For additional commands, e-mail: users-help@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-unsubscribe@appfuse.dev.java.net
>> >> For additional commands, e-mail: users-help@appfuse.dev.java.net
>> >>
>> >>
>> >
>> >
>> show gerogut@yahoo.com as gerogut
>> --
>> View this message in context:
>> http://old.nabble.com/Spring-MVC---Begginer-Question-tp26216556s2369p26222035.html
>>  Sent from the AppFuse - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@appfuse.dev.java.net
>> For additional commands, e-mail: users-help@appfuse.dev.java.net
>>
>>
>
gerogut

Re: Spring MVC or General - Begginer Question

Reply Threaded More More options
Print post
Permalink
In reply to this post by Wojciech Wąsowicz
I have mi dispatcher-servlet like this
<bean id="bookFileFormController" class="com.code54.bookshelf.webapp.controller.BookFileFormController">
    <property name="successView" value="redirect:bookfileform.html"/>
    <property name="bookFileManager" ref="bookFileManager"/>
    <property name="bookManager" ref="bookManager"/>
</bean>

the thing is I can't get the book id, how can y send the book from bookFileController to BookFileFormControler...

Wojciech Wąsowicz wrote:
2009/11/5 gerogut <gerogut@yahoo.com>:
>
>
> 4. When I click on a file, bookFileForm is displayed, the controller is
> BookFileFormController and it has a different manager wich is
> BookFileManager.(bookfileform.jsp) Here it's the problem, I can't get to
> associate the file to the book because I don't know how to get the book
> without an id. In this controller I only have the id of the bookFile. So,
> answering you second question, I can't add BookFile to the Book object.
>

Maybe you need to add to BookFileController the BookManager bean,
just the same way as BookFileManager is inserted ..

Then you can get Book from BookManager .. just need book.id from
request or bookFile ..

regards
Wojtek

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

Re: Spring MVC or General - Begginer Question

Reply Threaded More More options
Print post
Permalink
In reply to this post by ramzi khlil
Ramzi I received an email where it said something about keeping book id along the process and adding the book id in the action associated with the add button. I read that in the preview but I can't find the post.
Did you delete it? can you post it again?
thanks. Gero

ramzi khlil wrote:
Sorry I misunderstand you requirement,

A simple solution consists of creating a hidden field in BookFileList.jsp
that holds the id of the book.

Ramzi

On Thu, Nov 5, 2009 at 4:13 PM, ramzi khlil <ramzi.atvent@gmail.com> wrote:

> You can simply add your book object to the ModelAndView.
> Use a Map to include the book.
>
> Map objects = new HashMap();
> objects.put("ParentBook", book);
> objects.put("bookFileList",bookManager.get(book.getId()).getBookFiles());
> ModelAndView().addObject("bookFileList", objects);
>
>
>
> On Thu, Nov 5, 2009 at 3:54 PM, gerogut <gerogut@yahoo.com> wrote:
>
>>
>>
>> Can you describe the workflow.
>> How do you add BookFile to Book object ?
>>
>> Workflow:
>> 1. Books are loaded, the controller is BookController and BookManager gets
>> all books. (books.jsp)
>>
>> 2. I select a book and BookForm is loaded (with book info), controller is
>> BookFormController, command class is Book. (bookform.jsp)
>>
>> 3. I click de button "Files" and BookFileList is loaded, the controller is
>> BookFileController and there bookManager gets the book and then the set of
>> bookFiles which is returned as:
>>
>> return new
>>
>> ModelAndView().addObject("bookFileList",bookManager.get(book.getId()).getBookFiles());
>>
>> so the list of files is displayed. (bookfiles.jsp)
>>
>> 4. When I click on a file, bookFileForm is displayed, the controller is
>> BookFileFormController and it has a different manager wich is
>> BookFileManager.(bookfileform.jsp) Here it's the problem, I can't get to
>> associate the file to the book because I don't know how to get the book
>> without an id. In this controller I only have the id of the bookFile. So,
>> answering you second question, I can't add BookFile to the Book object.
>>
>> Gero
>>
>>
>> ramzi khlil wrote:
>> >
>> > Can you describe the workflow.
>> > How do you add BookFile to Book object ?
>> >
>> > Ramzi
>> >
>> >
>> >
>> > On Thu, Nov 5, 2009 at 2:57 PM, gerogut <gerogut@yahoo.com> wrote:
>> >
>> >>
>> >> 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.geronimo@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-unsubscribe@appfuse.dev.java.net
>> >> >> For additional commands, e-mail: users-help@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-unsubscribe@appfuse.dev.java.net
>> >> For additional commands, e-mail: users-help@appfuse.dev.java.net
>> >>
>> >>
>> >
>> >
>> show gerogut@yahoo.com as gerogut
>> --
>> View this message in context:
>> http://old.nabble.com/Spring-MVC---Begginer-Question-tp26216556s2369p26222035.html
>>  Sent from the AppFuse - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@appfuse.dev.java.net
>> For additional commands, e-mail: users-help@appfuse.dev.java.net
>>
>>
>
mraible

Re: nabble problem or is it me?

Reply Threaded More More options
Print post
Permalink
In reply to this post by oskarher
As you might've seen on the thread below, if you're a Nabble user, you'll have to re-register with the new system. As they say in the thread below, the good news is it won't take long at all.

Matt

On Fri, Nov 6, 2009 at 11:51 AM, Matt Raible <[hidden email]> wrote:
I asked them to upgrade to Nabble 2 this morning. If this requires everyone to re-register, that's not good at all.

Can you post a reply to the following and let them know?

http://n2.nabble.com/Please-Migrate-AppFuse-Forums-to-Nabble-2-td3960103.html#a3960103

Thanks,

Matt


On Fri, Nov 6, 2009 at 11:42 AM, -=j=- <[hidden email]> wrote:
Hi Folks,

I'm trying to find some old and more recent threads on nabble and got into a weird state, nabble made me register (again, since I've been on here for ages), and I wasn't seeing any activity later than sometime in 2008...?!?!?  Did I take a wrong turn or is nabble confused?  I am looking for this thread which I have in email but can't find on nabble:

Re: [appfuse-user] integrating enterprise mule & appfuse 2.02

I did find it via markmail but I genearlly like the nabble interface better... except today, it looks like I'm getting an old version or something, anybody know what's up with this?

Here's the article I can't find via nabble:

http://appfuse.markmail.org/search/?q=Re%3A%20[appfuse-user]%20integrating%20enterprise%20mule%20%26%20appfuse%202.02#query:Re%3A%20[appfuse-user]%20integrating%20enterprise%20mule%20%26%20appfuse%202.02%20list%3Anet.java.dev.appfuse.users%20from%3Ajackalista%20date%3A200403-200911%20+page:1+mid:vv7kytxmdetql3o6+state:results




ramzi khlil

Re: Spring MVC or General - Begginer Question

Reply Threaded More More options
Print post
Permalink
In reply to this post by gerogut
Gero,
 
I didn't delete it.
Are you talking about this ?
 
You need to keep the book id along the process.
So you need to add the book id in the action associated with add button.
When you clic on add button you should call this url bookfileform.html?Bookid=#
 
Anothor solution, add a binder to book object and display the list of book in BookFileForm.jsp.
 
Ramzi

On Sun, Nov 8, 2009 at 3:31 PM, gerogut <[hidden email]> wrote:

Ramzi I received an email where it said something about keeping book id along
the process and adding the book id in the action associated with the add
button. I read that in the preview but I can't find the post.
Did you delete it? can you post it again?
thanks. Gero


ramzi khlil wrote:
>
> Sorry I misunderstand you requirement,
>
> A simple solution consists of creating a hidden field in BookFileList.jsp
> that holds the id of the book.
>
> Ramzi
>
> On Thu, Nov 5, 2009 at 4:13 PM, ramzi khlil <[hidden email]>
> wrote:
>
>> You can simply add your book object to the ModelAndView.
>> Use a Map to include the book.
>>
>> Map objects = new HashMap();
>> objects.put("ParentBook", book);
>> objects.put("bookFileList",bookManager.get(book.getId()).getBookFiles());
>> ModelAndView().addObject("bookFileList", objects);
>>
>>
>>
>> On Thu, Nov 5, 2009 at 3:54 PM, gerogut <[hidden email]> wrote:
>>
>>>
>>>
>>> Can you describe the workflow.
>>> How do you add BookFile to Book object ?
>>>
>>> Workflow:
>>> 1. Books are loaded, the controller is BookController and BookManager
>>> gets
>>> all books. (books.jsp)
>>>
>>> 2. I select a book and BookForm is loaded (with book info), controller
>>> is
>>> BookFormController, command class is Book. (bookform.jsp)
>>>
>>> 3. I click de button "Files" and BookFileList is loaded, the controller
>>> is
>>> BookFileController and there bookManager gets the book and then the set
>>> of
>>> bookFiles which is returned as:
>>>
>>> return new
>>>
>>> ModelAndView().addObject("bookFileList",bookManager.get(book.getId()).getBookFiles());
>>>
>>> so the list of files is displayed. (bookfiles.jsp)
>>>
>>> 4. When I click on a file, bookFileForm is displayed, the controller is
>>> BookFileFormController and it has a different manager wich is
>>> BookFileManager.(bookfileform.jsp) Here it's the problem, I can't get to
>>> associate the file to the book because I don't know how to get the book
>>> without an id. In this controller I only have the id of the bookFile.
>>> So,
>>> answering you second question, I can't add BookFile to the Book object.
>>>
>>> Gero
>>>
>>>
>>> ramzi khlil wrote:
>>> >
>>> > Can you describe the workflow.
>>> > How do you add BookFile to Book object ?
>>> >
>>> > Ramzi
>>> >
>>> >
>>> >
>>> > On Thu, Nov 5, 2009 at 2:57 PM, gerogut <[hidden email]> wrote:
>>> >
>>> >>
>>> >> 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
>>> >> > <[hidden email]>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: [hidden email]
>>> >> >> For additional commands, e-mail: [hidden email]
>>> >> >>
>>> >> >>
>>> >> >
>>> >> >
>>> >>
>>> >> --
>>> >> 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: [hidden email]
>>> >> For additional commands, e-mail: [hidden email]
>>> >>
>>> >>
>>> >
>>> >
>>> show [hidden email] as gerogut
>>> --
>>> View this message in context:
>>> http://old.nabble.com/Spring-MVC---Begginer-Question-tp26216556s2369p26222035.html
>>>  Sent from the AppFuse - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [hidden email]
>>> For additional commands, e-mail: [hidden email]
>>>
>>>
>>
>
>

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

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]