Solved

inverse attribute in hibernate

Posted on 2011-03-10
7
708 Views
Last Modified: 2012-06-21
Hi,

I would like to know when we use inverse attribute. I saw setting inverse=true within set property attribute while doing many-one, one-many association hibernate examples. any  ideas, suggestions, sample code, resources, links highly appreciated.thanks in advance
0
Comment
Question by:gudii9
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 7

Accepted Solution

by:
techsathish earned 167 total points
ID: 35104894
This link will make you understand about the inverse with all you asked .. check it out and get a knowledege..

http://www.mkyong.com/hibernate/inverse-true-example-and-explanation/
0
 
LVL 20

Assisted Solution

by:Sathish David Kumar N
Sathish David  Kumar N earned 167 total points
ID: 35105034
Invesre key word is used for relation ship mapping like one to many and many to many !

>>>>>>>>>I would like to know when we use inverse attributeto avoid un nessery updates  from the relation ship mapping  

when we wont use ?

child update themself that time only we didnt use inverse=true
0
 
LVL 20

Expert Comment

by:Sathish David Kumar N
ID: 35105115
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 9

Assisted Solution

by:ioanton
ioanton earned 166 total points
ID: 35106176
Quotation from Hibernate docs:

"The rules are straightforward: all bi-directional associations need one side as inverse. In a one-to-many association it has to be the many-side, and in many-to-many association you can select either side."
0
 
LVL 7

Author Comment

by:gudii9
ID: 35218461
>>>In a one-to-many association it has to be the many-side, and in many-to-many association you can select either side

I have not clearly understood this. Can you please elaborate this.
0
 
LVL 9

Expert Comment

by:ioanton
ID: 35225598
You can find here a more detailed description of the problem:

http://swik.net/itefforts/itefforts+blog/Understanding+%22inverse%22+mapping+attribute/bo772
0
 
LVL 7

Author Comment

by:gudii9
ID: 35369062
in above link i read like

>>>

What is “inverse”?

This is the most confusing keyword in Hibernate, at least i took quite a long time to understand what is it. The “inverse” keyword is always declared in one-to-many and many-to-many relationship (many-to-one doesn’t has inverse keyword), It defines which side is responsible to take care of the relationship.

Always put inverse=”true” in your collection variable?

There are many Hibernate articles try to explain the “inverse” with many Hibernate “official” jargon, which is very hard to understand (at least to me). In few articles, they even suggested that just forget about what is “inverse”, and always put the inverse=”true” in the collection variable. This statement is always true – “put inverse=true in collection variable”, but do not blindfold on it, try to understand the reason behind is essential to optimal your Hibernate performance.

“inverse”, can it change to “relationship owner”?


i still not clear on it. please advise
0

Featured Post

Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
In this post we will learn different types of Android Layout and some basics of an Android App.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
The viewer will learn how to implement Singleton Design Pattern in Java.

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question