-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: Hibernate with objects that have member variables in HashMap
PostPosted: Thu May 20, 2004 9:31 pm 
Newbie

Joined: Thu May 20, 2004 9:15 pm
Posts: 4
Hi
I have a interesting problem. We use XML based metada(Proprietary) for our software and instead of generating classes for each object, we have a generic object that gets it's attributes from this metadata and they sit in a HashMap as name, value pairs. We have methods like getAttributeValue(String attributeName) to return value.
Now we want to persist this objects in database as any regular object can be done using hibernate(like each attribute in the object mapped to a column in table). These objects don't confirm to any java bean standards and only way to save is by getting the HashMap out of each object and saving its contents as name, value pairs(like regular bean object).
Can I use Hibernate to save these objects in database?

Thanks
Rav


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 21, 2004 3:31 am 
Regular
Regular

Joined: Wed May 12, 2004 3:03 am
Posts: 51
Location: France
Hi,

Do you mean that your generic object has an attibut which type is an HashMap is wich all the "real" attributes are?


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 21, 2004 6:56 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Take a look at dynamic-component, it is not very well documented, but basically works like a normal component, only it is represented as a hashmap. This in combination with maybe a custom PropertyAccessor should allow you to solve your problem.


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 21, 2004 9:24 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
simply implement net.sf.hibernate.property.PropertyAccessor


Top
 Profile  
 
 Post subject: Thanks
PostPosted: Fri May 21, 2004 8:13 pm 
Newbie

Joined: Thu May 20, 2004 9:15 pm
Posts: 4
Hi
Thanks for a prompt reply. I will use it and hopefully it will work smoothly.

Rav


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.