-->
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.  [ 1 post ] 
Author Message
 Post subject: mapping a hashmap only
PostPosted: Wed Mar 16, 2005 5:41 pm 
Newbie

Joined: Wed Mar 16, 2005 5:32 pm
Posts: 1
I'm using hibernate in my new project and so far I love it :) I managed to map classes with collections etc, but now I'd like to persist this "configuration" class and I have no clue how to do this without declaring multiple tables. I'd like to have one "configuration" table with a key and value. The entire table should be loaded. Is this possible with hibernate?

Code:
public class Config
{
    private Map values;
       
    public Map getValues()
    {
        return values;
    }
   
    public void setValues(Map values)
    {
        this.values = values;
    }
       
}


I've tried this:

Code:
    <class name="Config" table="CLIENT_CONFIGURATION">
          <id type="long" unsaved-value="0">
            <column name="config_id" sql-type="number(8)" not-null="true"/>
            <generator class="native"/>
      </id>
      <map name="values" table="CLIENT_CONFIGURATION" lazy="false">
         <key column="config_id"/>
         <index column="setting" type="string"/>
         <element column="value" type="string"/>
      </map>
   </class>


but this requires a fk to a collection table which I do not have... Any suggestions?


Hibernate version:
2.18
Name and version of the database I'm using:
Oracle 9


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

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.