Link to home
Start Free TrialLog in
Avatar of gudii9
gudii9Flag for United States of America

asked on

inverse attribute in hibernate

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
ASKER CERTIFIED SOLUTION
Avatar of techsathish
techsathish
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Sathish David  Kumar N
Sathish David Kumar N
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gudii9

ASKER

>>>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.
Avatar of ioanton
ioanton

You can find here a more detailed description of the problem:

http://swik.net/itefforts/itefforts+blog/Understanding+%22inverse%22+mapping+attribute/bo772
Avatar of gudii9

ASKER

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