java - Hibernate List returns same object reference for same values in table -


  • a has many-to-one relationship b.
  • b kind of type/category table.

i storing b primary keys in table. when query list of following

   sqlquery query = session.createsqlquery("select * a");    query.addentity(a.class);    list list  = query.list();     a.hbm.xml    <many-to-one         class="b"          fetch="select" name="b" lazy="no-proxy">         <column name="b_id" />     </many-to-one> 

this list has same object references of b same primary keys. has 4 records out of 2 records have same b value. have same object reference of b here though 2 different records of a. need different object reference of b here.

any appreciated. thanks!


Comments

Popular posts from this blog

android - net_scheduler holding wakelock -

sql - MySQL : Getting Entries from a many-to-many table -

java - Retrieving data from database using jsp (Hibernate + Spring + Maven) -