• +91 9723535972
  • info@interviewmaterial.com

Hibernate Interview Questions and Answers

Question - How can I retrieve the identifier of an associated object, without fetching the association?

Answer - Just do it. The following code does not result in any SELECT statement, even if the item association is lazy. Long itemId = bid.getItem().getId(); This works if getItem() returns a proxy and if you mapped the identifier property with regular accessor methods. If you enabled direct field access for the id of an Item, the Item proxy will be initialized if you call getId(). This method is then treated like any other business method of the proxy, initialization is required if it is called.

Comment(S)

Show all Coment

Leave a Comment




NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners