473,395 Members | 2,437 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,395 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 4735
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.