Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Setting the values in POJO Class after fetching the values from db via hibernate

 
shivang sarawagi
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Setting the values in POJO Class after fetching the values from db via hibernate



Fetch the owners from the db and display in the jsp.

My POJO class



My question may seem a little bizzare, I know in the jsp the get*() methods are being called by the EL, but where are the set*() methods for the Owner class called? How is the value being set in the POJO?

Are the values after being fetched from the db being set in the POJO internally by hibernate?
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The persistence provider (for example: Hibernate) is responsible for setting those values in the object that gets returned. It depends on the persistence provider, whether it calls the setters or uses other methods (like direct field access via reflection) to set those values in the object.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic