473,597 Members | 2,749 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

15 New Member
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 4742
r035198x
13,262 MVP
@CatchSandeepVai d
But there are already lots of people using hibernate "efficientl y (and acceptably) in real J2EE applications".
@CatchSandeepVai d
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
1125
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
12439
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 they mature in the .NET world yet? Thanks, Peter
2
4299
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 hibernate dll 2)what is the purpose of this hibernate please help me
0
1100
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
3688
by: lumpybanana247 | last post by:
is there a function, etc that will let you hibernate our computer using c++? thanks
1
1763
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. I need HELP please. Thanks Manny
1
1520
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 didn't work. How do I find out what has caused the problem? How do I fix it?
2
1329
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
2517
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
4136
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
7886
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8272
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8035
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6688
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5431
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3886
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2404
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1494
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1238
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.