473,324 Members | 2,196 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Hibernate :One-to-one association must return null instead of proxy (or actual object

I have posted this question in hibernate forums also.. As this forum is related to java, i am posting it here also ...

In hibernate, presently one-to-one associations are fetched non-lazily...
I know that this is done because, hibernate requires to fire 1 sql to find whether proxy can be created or not...
and if it has to fire 1 sql, then why not to load one-to-one object itself in 1 sql instead of creating proxy of it (in 1 sql).

Consider my scenario..
Product has one-to-one with ProductBasic which has one-to-one with ProductTerm

Now i just queried for List of Products and i got say 300 product records.. (in 1 sql query)
In this case i don;t require ProductBasic and ProductTerm.... but as these are one-to-one associations, there are
compulsorily non-lazily fetched. Thus another 300 + 300 select queries are fired to get ProductBasic and ProductTerm
which is surely unacceptable as there are 600 extra sql's getting fired.. The situation may become worst if i
have many one-to-one associations in my domain tree.

I think hibernate code must be changed so that one-to-one associations should be not compulsorily non-lazily fetched....

One way i could think of it is, if user has not asked to fetch one-to-one association then instead of
loading one-to-one object (or creating proxy) simply null should be returned without firing any SQL...
Later when user asks for this one-to-one association, now fire 1 sql to get this association..

The major advantage of this approach is that if user has not asked for one-to-one association, no extra sql (unnecessary)
queries will be fired... (specially when retriving parent collection - e.q our scenario described above)..

This critial problem will always occur when we fetch any collection in the domain tree...
All it's one-to-one associations will be compulsorily fetched for 'n' records. and as n increases, the problem becomes severe..

As per my knowledge, this problem is so critical and severe, that if not solved, nobody will be able to use hibernate
efficiently (and acceptably) in real J2EE applications and hence i request for an immediate solution for this problem..
Jun 18 '09 #1
1 4731
r035198x
13,262 8TB
@CatchSandeepVaid
But there are already lots of people using hibernate "efficiently (and acceptably) in real J2EE applications".
@CatchSandeepVaid
As I already told you before, this is not the place to be posting change requests to hibernate. None of us here have much to do with how hibernate is implemented. Contact hibernate.org for that.
Jun 18 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Robert Misiak | last post by:
Hi everyone- How can you figure out if the system has just returned from suspension or hibernation? Robert
2
by: Peter Kirk | last post by:
Hi there I come from the "Java world" where I used "Spring" and "Hibernate" in web-application development. Is there anyone who has experience using these frameworks in a .NET / c# setting? Are...
2
by: venkat3475 | last post by:
Ha friends...... anybody have an idea on hibernate in asp.net.friends ,i dont know any idea regarding this technology...i have a few questions 1)where can i get this...
0
by: seshasr | last post by:
Am getting log4j system error not properly logged in and an exception is thrown whichever i had given in the main function
2
by: lumpybanana247 | last post by:
is there a function, etc that will let you hibernate our computer using c++? thanks
1
by: =?Utf-8?B?TWFubnkgUGF0ZWw=?= | last post by:
I have HP Pavilion m400y desktop with Windows Xp PROF. I have tried several things using Control Panel-Power Scheme but my computer does not go in Hibernate or Standby mode after preset idle time....
1
by: =?Utf-8?B?U2NpZW50aXN0c211cmY=?= | last post by:
I have a Dell Inspiron 6400 running Windows XP Pro SP2. It is updated regularly. The hibernate and standby buttons on the shutdown window have greyed out. I've updated the video driver. This...
2
hirak1984
by: hirak1984 | last post by:
Do we have any dedicated Spring and Hibernate forum out here? Or all these are included in Java forum??
2
ashitpro
by: ashitpro | last post by:
I've just posted my problem over hibernate forum... seems like I'm not getting answer.. You can look at this link: https://forum.hibernate.org/viewtopic.php?f=1&t=996869
1
by: jx2 | last post by:
What is the difference between Hibernate, TopLink and EclipseLink? are they types of persistence? thanks for your help Jan
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.