aspose 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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
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
How to map column to a property ?
Hibernate with native SQL issue
SQL-Query not returning specified Object
Classcast exception
could not read column value from result set: IS6_32_0_; Invalid column name