File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes how to save collection object into database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "how to save collection object into database" Watch "how to save collection object into database" New topic
Author

how to save collection object into database

Saikiran Madhavan
Greenhorn

Joined: May 15, 2006
Posts: 28
Hi,

We are having an object which has a collection (Set), i would like to save the set whenever i save that particular Class.

The Set has got many-to-many relation with another class.

The hbm file for that particular class and the database table is given below:-



the database table is as below:-

Mailbox table

mailbox_id
name
description
administrator_admin_id
notification_email

Account_Mailbox
account_id
mailbox_id

now when i save or update Mailbox object i have to save the accounts set along with it.

can anyone help me out in this regard

cheers
sai
Arun Kumarr
Ranch Hand

Joined: May 16, 2005
Posts: 513

fill the set with account_mailbox pojos and save the mailbox pojo. What happens? Aren't the account_mailbox details persisted in the link table. Do you see sany exceptions?


If you are not laughing at yourself, then you just didn't get the joke.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to save collection object into database
 
Similar Threads
Classcast exception
SQL-Query not returning specified Object
Hibernate with native SQL issue
could not read column value from result set: IS6_32_0_; Invalid column name
How to map column to a property ?