Hibernate version:2.1.6
using:Oracle 8i
Hi,
I am new to Hibernate.
I have some classes with simple HashMaps or Properties members.
they are usually contains Key-string and Value-string
can someone please show me what should be the Mapping for such a class and how should it look like in the database ?
I tried somthing like :
class :
Code:
public class Group {
private String id;
public String name;
public String gdlName;
public HashMap gdlArgs;
Oracle :
Code:
GRP3
Name Type
------------------ ------------
ID VARCHAR2(40)
NAME VARCHAR2(40)
GDLNAME VARCHAR2(40)
GDLARGS_ID NUMBER(10)
GDLARGS
Name Type
-------------------- ------------
GDLARGS_ID NUMBER(10)
KEY VARCHAR2(40)
VALUE VARCHAR2(40)
and Map :
Code:
<class name="test.hibernate.Group" table="GRP3">
<id name="id" type="string" unsaved-value="null" >
<column name="id" sql-type="char(32)" not-null="true"/>
<generator class="uuid.hex"/>
</id>
<property name="name">
<column name="name" sql-type="char(40)" not-null="true"/>
</property>
<property name="gdlName">
<column name="gdlName" sql-type="char(40)" not-null="true"/>
</property>
<map name="gdlArgs" table="GDLARGS">
<key>
<column name="GDLARGS_ID" sql-type="NUMBER(10)" />
</key>
<index type="object" column="KEY" />
<element type="object" column="VALUE" />
</map>
</class>
I got
collection element mapping has wrong number of columns
and when index/element type were
string instead of "object" i got :
Quote:
exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of test.hibernate.Group.setGdlArgs
What am I doing wrong ?