ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "MCCORMICK, Paul" <Paul.McCORM...@doir.wa.gov.au>
Subject RE: Lazy Load is pre loading 1-1 relationships
Date Wed, 12 Sep 2007 06:42:42 GMT

Be careful with lazy loading 1-1 relationships where the lazy loaded
result could be null.  A proxy object will be in its place.

e.g.
if ( foo.getBar() == null )  { // Bar is lazy loaded.
    // Unreachable code
}

________________________________

From: Poitras Christian [mailto:Christian.Poitras@ircm.qc.ca]
Sent: Wednesday, 12 September 2007 4:05 AM
To: user-java@ibatis.apache.org
Subject: RE: Lazy Load is pre loading 1-1 relationships


It seems that is works with my classes.

I don't use
private static final long serialVersionUID = -1699855014908794446L;
I use.
static final long serialVersionUID = 7213712437136303104L;

Give it a try!
Christian


________________________________

From: Christopher.Mathrusse@sybase.com
[mailto:Christopher.Mathrusse@sybase.com]
Sent: Tuesday, 11 September 2007 15:57
To: user-java@ibatis.apache.org
Subject: RE: Lazy Load is pre loading 1-1 relationships



That was it! I removed the variable definition from all my domain
objects, performed a clean and build and the lazy loading is now working
correctly. Thanks for the suggestion.





Christopher.Mathrusse@sybase.com

09/11/2007 12:30 PM
Please respond to
user-java@ibatis.apache.org


To
user-java@ibatis.apache.org
cc
user-java@ibatis.apache.org
Subject
RE: Lazy Load is pre loading 1-1 relationships

	





This may actually answer my question. I recently added to my domain
objects the following:

private static final long serialVersionUID = -1699855014908794446L;

I added this to eliminate the warning that Eclipse was giving me. Any
object that I needed to touch as of recently I would add this to. The
domain objects that are not lazily loading seem to be the ones that I
added serialVersionUID to.

Thanks for the help...




"Poitras Christian" <Christian.Poitras@ircm.qc.ca>

09/11/2007 12:22 PM

Please respond to
user-java@ibatis.apache.org

To
<user-java@ibatis.apache.org>
cc
Subject
RE: Lazy Load is pre loading 1-1 relationships


	





I doubt my reply will answer your question, but this is mostly for
information purpose.

All final classes are never lazy loaded by iBATIS. This include any
primitive type, Strings and this like Integer, Double, etc...
This "bug" is probably due to the fact that cglib tries to extend the
class. If it is final, it must be loaded now.

Christian


________________________________

From: Christopher.Mathrusse@sybase.com
[mailto:Christopher.Mathrusse@sybase.com]
Sent: Tuesday, 11 September 2007 15:12
To: user-java@ibatis.apache.org
Subject: Lazy Load is pre loading 1-1 relationships


I've been spending a fair amount of time on this now but I can't seem to
get any further. Objects that I am attempting to load lazily are simply
loading. The relationships that are 1-M seem to be fine, meaning that
they are not pre-loading, but any relationship that I have that is a 1-1
seems to be loaded when the resultSet is applied to the parent object.
Is there anything I can do to prevent this from happening?

Thanks...



"DISCLAIMER: This email, including any attachments, is intended only for use by the addressee(s)
and may contain confidential and/or personal information and may also be the subject of legal
privilege. If you are not the intended recipient, you must not disclose or use the information
contained in it. In this case, please let me know by return email, delete the message permanently
from your system and destroy any copies.

Before you take any action based upon advice and/or information contained in this email you
should carefully consider the advice and information and consider obtaining relevant independent
advice.
Mime
View raw message