• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

hibernate mapping error

 
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 85
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
Can you post the error message that you are getting.
 
Janhavi Namshikar
Ranch Hand
Posts: 85
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Janhavi Namshikar,

Thank u. it's fine working.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic