Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Object Relational Mapping
Search Coderanch
Advance search
Google search
Register / Login
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
Forum:
Object Relational Mapping
Many to one relationshilp table have same entity name returns wrong value
sampath soft
Greenhorn
Posts: 17
posted 10 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi,
I have Two Table FOLDER and TOPIC. Their hbm as follows...
<hibernate-mapping> <class name="com.company.Folder" table="FOLDER"> <id name="folderId" type="java.lang.Long" > <column name="FOLDER_ID" /> <generator class="native"/> </id> <many-to-one name="topicId" class="com.company.Topic" fetch="select" lazy="false" > <column name="TOPIC_ID" not-null="true" /> </many-to-one> <property name="parentId" type="java.lang.Long"> <column name="PARENT_ID" not-null="false" /> </property> </class> </hibernate-mapping> <hibernate-mapping> <class name="com.company.Topic" table="TOPIC" > <cache usage="nonstrict-read-write"/> <id name="topicId" type="java.lang.Long"> <column name="TOPIC_ID" precision="22" scale="0" /> <generator class="native"/> </id> <property name="parentId" type="java.lang.Long"> <column name="PARENT_ID" precision="22" scale="0" not-null="false" /> </property> </class> </hibernate-mapping>
I have enabled second level ehcache for both table.
<cache name="com.company.Folder" maxElementsInMemory="300" eternal="true" overflowToDisk="false"/> <cache name="com.company.Topic" maxElementsInMemory="300" eternal="true" overflowToDisk="false"/>
when i call
folder.getTopicId().getParent()
instand of hibernate returning parentId of TOPIC, it returns the parentId of FOLDER. Some time it returns correct value some time not.
Can you help me to fix and explain this
Thanks in advance
There are 10 kinds of people in this world. Those that understand binary get this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Hibernate generate select while storing object.
hibernate get parent based on children
Classcast exception
Hibernate: Problem with View returning list of nulls
More...