jQuery in Action, 2nd edition
The moose likes Object Relational Mapping and the fly likes hibernate mapping error Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Object Relational Mapping
Reply Bookmark "hibernate mapping error" Watch "hibernate mapping error" New topic
Author

hibernate mapping error

raj baig
Ranch Hand

Joined: Jul 11, 2006
Posts: 96
can i map a single table to two java beans(same setters and getters).
when i am trying to access it shows some mapping error.the code is

<class name="abc.login.User" table="myuser1">
<id name="user_id" column="user_id">
<generator class="assigned"/>
</id>
<property name="account_id" column="account_id"/>
<property name="uname" column="uname"/>
<property name="pwd" column="pwd"/>
</class>
<class name="xyz.login.User" table="myuser1">
<id name="user_id" column="user_id">
<generator class="assigned"/>
</id>
<property name="account_id" column="account_id"/>
<property name="uname" column="uname"/>
<property name="pwd" column="pwd"/>
</class>


here the tables is one. beans are of type user with the same setters and getters stored in different packages
Janhavi Namshikar
Ranch Hand

Joined: Sep 29, 2005
Posts: 85

Hi
Can you post the error message that you are getting.


"Weekends don't count unless you spend them doing something completely pointless."
Janhavi Namshikar
Ranch Hand

Joined: Sep 29, 2005
Posts: 85

Hi,

Try this, use the entity-name attribute to differentiate between the two instances.

<class name="MyClass" table="mytable"
entity-name="somename">
<property name="prop" column="col">
</class>


<class name="MyClass" table="mytable"
entity-name="othername">
<property name="prop" column="col">
</class>
raj baig
Ranch Hand

Joined: Jul 11, 2006
Posts: 96
hi Janhavi Namshikar,

Thank u. it's fine working.
 
 
subject: hibernate mapping error
 
Threads others viewed
HBM mapping Problem
Simple one-to-one relationship with FK.
hibernate mapping exception
The same old foreign key issue
One-to-One mapping problem
developer file tools