Solved

inverse attribute in hibernate

Posted on 2011-03-10
7
663 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
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 7

Accepted Solution

by:
techsathish earned 167 total points
Comment Utility
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
Comment Utility
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
Comment Utility
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 9

Assisted Solution

by:ioanton
ioanton earned 166 total points
Comment Utility
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
Comment Utility
>>>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
Comment Utility
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
Comment Utility
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

763 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now