On Sep 27, 2006, at 1:41 AM, Niels Beekman wrote:
Can we see your config?
What all would you like to see? It's a large application and the
example I posted is just a snippet. Here's more from my sql config
and dao config:
<sqlMapConfig>
<properties resource="org/projectFoundry/config/jdbc.properties"/>
<settings enhancementEnabled="true"/>
<transactionManager type="JDBC">
<dataSource type="SIMPLE">
<property name="JDBC.Driver" value="${JDBC.Driver}"/>
<property name="JDBC.ConnectionURL" value="$
{JDBC.ConnectionURL}"/>
<property name="JDBC.Username" value="${JDBC.Username}"/>
<property name="JDBC.Password" value="${JDBC.Password}"/>
</dataSource>
</transactionManager>
<sqlMap resource="org/projectFoundry/persistence/project/
ProjectSqlMap.xml"/>
<sqlMap resource="org/projectFoundry/persistence/user/
UserSqlMap.xml"/>
etc.
</sqlMapConfig>
<daoConfig>
<context>
<transactionManager type="SQLMAP">
<property name="SqlMapConfigResource" value="org/
projectFoundry/config/sql-map.xml"/>
</transactionManager>
<dao
interface="org.projectFoundry.persistence.project.ProjectDao"
implementation="org.projectFoundry.persistence.project.ProjectSqlMapDao"
/>
<dao interface="org.projectFoundry.persistence.user.UserDao"
implementation="org.projectFoundry.persistence.user.UserSqlMapDao"/>
etc.
</context>
</daoConfig>
Tom
-----Original Message-----
From: Tom Duffey [mailto:[EMAIL PROTECTED]
Sent: woensdag 27 september 2006 7:34
To: [email protected]
Subject: lazy loading confusion
Hi All,
I have a Project class with a list of Members. It is my
understanding that I can turn on lazy loading in my sql map config,
define a Project result map like:
<resultMap id="result" class="foo.Project">
<result property="projectId" column="id"/>
<result property="members" column="id"
select="Member.listByProject"/>
</resultMap>
and then retrieve a project and the members will not be retrieved
unless I call getMembers() on the project instance. Is this how it's
supposed to work? What I'm finding is that the members list is
populated even if I do not call getMembers(). To back this idea I
renamed the property in the result map to "members2" and added a new
members2 attribute to the project class (To make sure I didn't miss
any calls to getMembers) and sure enough it is still populated when I
retrieve the project.
What gives? I thought the point of lazy loading was to not load data
unless I ask for it. I'm using iBATIS 2.1.7 for Java.
Best Regards,
Tom Duffey