• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

performance of hibernate?

 
Piyush Patel
Ranch Hand
Posts: 127
Android Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,i am new to hibernate. i started using hibernate in my j2se project. in hibernate List result that hibernate returns is List of objects of database table.
i want to know that the result objects i got occupies memory in jvm, do i need something to remove this objects when i complete its use?

or do i need to make List of objects null to free memory space?
please help
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy Greenhorn!

Don't go making those lists null! You may end up deleting the association between the aggregating object and it's collection.

When the transaction is completed, and the object goes out of scope, normal Java garbage collection will take care of the list. Of course, it's good to only query what you need, so you don't get massive lists in the first place, but for the most part, this shouldn't be a problem.

-Cameron McKenzie
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And if you do need to remove the List, then you just evict() it from the Session. Because even if you null out your reference to the List, it is still in the Hibernate Session's maps.

Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic