• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

No proxy with session.load() instead it does a database hit - Why?

 
Ranch Hand
Posts: 1855
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I recently recognized that calling session.load() like does not create a proxy as described by Hibernate's Java Persistence with Hibernate on p.564

Instead it creates a database hit, just the thing that the Hibernate guys want to avoid for performance reason.

I use Hibernate 3.2. Has anyone made similar experience

My hibernate mapping file says lazy="true", so why on earth does session.load() hit the database with a SELECT instead of giving me a proxy


Regards,
Darya
[ September 12, 2007: Message edited by: Darya Akbari ]
 
Darya Akbari
Ranch Hand
Posts: 1855
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe it's a bug and I'm the first who encountered it
 
Darya Akbari
Ranch Hand
Posts: 1855
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The database I use is Oracle.
 
Darya Akbari
Ranch Hand
Posts: 1855
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Got it ,

The problem was that I didn't have a proxy="my pojo class" set in my hibernate mapping file due to the description in the book.

Anyway I have my proxy now

Regards,
Darya
 
Darya Akbari
Ranch Hand
Posts: 1855
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
... finally, take care that the proxy stuff only works with concrete POJOs.

Polymorphy is not supported by it
 
reply
    Bookmark Topic Watch Topic
  • New Topic