This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Beginning Java and the fly likes Best way to update collection, who has responsibility, in DAO + one-to-many situation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Best way to update collection, who has responsibility, in DAO + one-to-many situation" Watch "Best way to update collection, who has responsibility, in DAO + one-to-many situation" New topic
Author

Best way to update collection, who has responsibility, in DAO + one-to-many situation

Bert Bertens
Greenhorn

Joined: Feb 16, 2010
Posts: 14
Hi,

I was wondering what's the best way to do the following.

client logs in on website,
client selects a "Project"
client uploads an "Image" for the selected "Project".

I have a Project-class which contains a Set of Image-instances.

this is the code when the user presses the upload-button, from the ImageBean-class:


Is this a good way to do it? Or should the create-method of the imageService-class do the p.addImage and projectService.update stuff?
Or should there be a projectService.addImageForProject(Image image) method?

Kind regards
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Best way to update collection, who has responsibility, in DAO + one-to-many situation