views:

39

answers:

1

As a Java programmer, you usually keep two truths in your pocket:

  • Instance variables and Objects lie on Heap.
  • Local variables and methods lie on the Stack.

Now that I use Hibernate in just about everything, I realize I'm not as sure of myself.

Are there some good rules of thumb for using hibernate and knowing where your memory lives?

+3  A: 

I'm not really sure what you mean. I do know that all objects (Hibernate or other), even if you only have a local reference to them, go on the heap.

I'd worry more about the correctness of your code than this sort of thing, I doubt it'll noticeably affect performance. One database query would dwarf the possible speed difference.

Bart van Heukelom