-->
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 of colums to Map
PostPosted: Tue Apr 13, 2004 9:53 am 
Newbie

Joined: Fri Apr 02, 2004 9:18 am
Posts: 5
Location: Cologne, Germany
Hello,

how can I map attributes of a class stored in a java.util.Map to columns of the same table?

Code:
public class A {

private String id;
private Map attributes = new HashMap();

public String getId() { return this.id;}
protected void setId(String newId) { this.id = newId; }

public Object getProperty(Object name) { return this.attributes.get(name); }
public void setProperty(Object name, Object value) { this.attributes.put(name, value); }
}


For example to a table:

Code:
Person
-------
id varchar(16) (P.K)
firstname varchar2(50)
lastname varchar2(50)
address_id number(6)

<hibernate-mapping>
    <class name="A" table="person">
        <id name="id" type="string" unsaved-value="null" >
            <column name="id" sql-type="VARCHAR" not-null="true"/>
            <generator class="uuid.string"/>   
        </id>

   <!-- How do I map the properties here? -->
   
    </class>
</hibernate-mapping>


I read a posting by Gavin that there are plans to support 'generic' code (via HashMaps) and 'typesafe' code (via classes)'.

Thanx for any suggestions.


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.