-->
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.  [ 2 posts ] 
Author Message
 Post subject: OOR mapping for a class implements Map
PostPosted: Fri Nov 14, 2008 4:12 pm 
Newbie

Joined: Fri Nov 14, 2008 4:07 pm
Posts: 6
Hi,

Any help on this is greatly appreciated.

I need to persist a class using Hebernate3 like this

public class MyClass implements Map<String, Object> {

....................

}

I don't know how to write an O/R mapping for this.

Anybody can give me a clue?

Thanks

Eddie


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 14, 2008 5:02 pm 
Expert
Expert

Joined: Mon Nov 26, 2007 2:29 pm
Posts: 443
In theory, it can be done, but it doesn't make much sense.
The members (properties) of a class have to be mapped to columns on a BD, and those columns are fixed in the table, while the key/values you put in a Map are not.

Maps are good to persist collections of children objects, because you have a known column (which is the key) and an additional table to contain child objects. But making a map itself a persistent class is not something you can easily represent in a table.

If what you are attempting, is to define your data model dynamically with maps instead of fixed classes, you might consider "dynamic models" with maps (Item 4.4 in the documentation).

_________________
Gonzalo Díaz


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.