Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Problem with EntityMode.MAP
PostPosted: Mon Apr 24, 2006 6:48 am 
Newbie

Joined: Wed Apr 19, 2006 5:35 am
Posts: 7
Hi am a newbie with Hibernate version 3.1.0

i am trying to map a table dynamically to a Map

I have the following for hibernate-mapping

Code:
<hibernate-mapping>
<class entity-name="bsc" table="bsc">
<id name="code" column="bsc_code"/>
<property name="shortname" column="shortname" type="string"/>
<property name="longname" column="longname" type="string"/>
</class>
</hibernate-mapping>


i have then added this resource to the hibernate.cfg.xml

then i am running the following code

Code:
Session ds = sf.openSession().getSession(EntityMode.Map);
Map bsc=new HashMap();
bsc.put("code",new Integer(9));
bsc.put("shortname","short");
bsc.put("longname","long");
ds.save("bsc",bsc);
ds.close();


and i receive the following excveption when i run the code

Code:
org.hibernate.MappingException: Unknown Entity: bsc


Can someone please help and guide me as to what i have done wrong as essentially this is just the example from the manual.

thanks in advance


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 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.