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
|