-->
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: How to use the MAP EntityMode?
PostPosted: Wed Jan 18, 2006 4:18 am 
Newbie

Joined: Mon Jan 16, 2006 8:41 am
Posts: 6
Hi everybody,

I am trying to use the MAP EntityMode feature of hibernate as follow:

i created a mapping file (hbm) for one simple "User" class:
<hibernate-mapping package="test.entities">
<class lazy="false" entity-name="User" table="USER">
<id name="id" column="ID" type="long">
<generator class="native"/>
</id>
<property name="username" column="USERNAME" type="string"/>
<property name="password" column="PASSWORD" type="string"/>
</class>
</hibernate-mapping>

Then, i created my Configuration object and my SessionFactory, ok everything went fine. Then i saved my "user" entity in my db as follow:

Map user1 = new HashMap();
user1.put("username", "David");
user1.put("password", "david");
session.save("User", user1);

OK, no error occurs, BUT if i try to exec "session.save("test.entities.User", user1)" then i got an error "unknown entity: test.entities.User !".

Moreover, if i execute a hql query (from test.entities.User as u where u.username=:uname and u.password=:upwd) referencing the user entity with the full package name, then i got the same error !

Does anybody knows how to use package names?
Am i doing something totally wrong?
Or is hibernate forcing me to have unique entities names? (this one seems strange...)

Many thanks for your help!

Best regards,

/Jean-Baptiste


Top
 Profile  
 
 Post subject: similar problem
PostPosted: Mon Apr 24, 2006 6:35 am 
Newbie

Joined: Wed Apr 19, 2006 5:35 am
Posts: 7
Hi i am having a similar problem except that i cannot save my Map at all, i think i have the configuration etc set up correctly but am not sure, please post your configuration code for me to look at

thanks in advance


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:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.