Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Some objects with association not getting created
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  7 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Guy Rouillier  
View profile  
 More options Oct 27 2011, 3:12 am
From: Guy Rouillier <g...@burntmail.com>
Date: Thu, 27 Oct 2011 03:12:54 -0400
Local: Thurs, Oct 27 2011 3:12 am
Subject: Some objects with association not getting created
I'm facing a really bizarre problem with a result set containing
associations.  When I turn on log4j debugging, I can see all my data
rows being returned.  But if I look at the log of objects created, one
or two of them are not being created.  And the ones missing are not
always the same.

Here is my result map.  I tried several variations, one using a
constructor within the association, and this one.  Both of them
encounter the same problem:

<resultMap id="hubStatsMap"
    type="com.masergy.lsp.db.bean.HubPairValue">
    <result column="DATESTAMP" property="sampleDate" jdbcType="VARCHAR" />
    <result column="COUNT" property="value" jdbcType="INTEGER" />
    <association property="sourceHub" javaType="db.bean.Hub">
       <result column="HUB" property="abbr" jdbcType="VARCHAR"
javaType="String"/>
       <result column="HUB" property="label" jdbcType="VARCHAR"
javaType="String"/>
    </association>
    <association property="destinationHub" javaType="db.bean.Hub">
       <result column="FAR_HUB" property="abbr" jdbcType="VARCHAR"
javaType="String"/>
       <result column="FAR_HUB" property="label" jdbcType="VARCHAR"
javaType="String"/>
    </association>
</resultMap>

Here is a sample of my retrieved data; no object was created for the row
SNGP, NWRK.  I don't see anything unique about that data that would
cause a problem:

Row: SNGP, LONI, 2011-10-27 06:25:00, 13544
Row: SNGP, MIAS, 2011-10-27 06:25:00, 13095
Row: SNGP, NWRK, 2011-10-27 06:25:00, 208 <== no object created
Row: SNGP, NYCM, 2011-10-27 06:25:00, 30355
Row: SNGP, PARC, 2011-10-27 06:25:00, 1341

If I comment out the associations, all the objects get created.  Any
idea what could be causing this problem?

Thanks.

--
Guy Rouillier


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Guy Rouillier  
View profile  
 More options Oct 28 2011, 1:58 am
From: Guy Rouillier <g...@burntmail.com>
Date: Fri, 28 Oct 2011 01:58:59 -0400
Local: Fri, Oct 28 2011 1:58 am
Subject: Re: Some objects with association not getting created
I tried a couple of settings in the config file to see if they would help:

        <settings>
                <setting name="lazyLoadingEnabled" value="false"/>
                <setting name="aggressiveLazyLoading" value="false"/>
        </settings>

Unfortunately, I still have the same problem, with both or either one of
the above settings enabled.  This is the first I'm aware that
associations have this problem.  We use them widely; hopefully they are
not causing hidden problems elsewhere.

Appreciate any ideas on getting this to work.  Thanks.

On 10/27/2011 3:12 AM, Guy Rouillier wrote:

--
Guy Rouillier

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Poitras Christian  
View profile  
 More options Oct 28 2011, 8:23 am
From: Poitras Christian <Christian.Poit...@ircm.qc.ca>
Date: Fri, 28 Oct 2011 08:23:40 -0400
Local: Fri, Oct 28 2011 8:23 am
Subject: RE: Some objects with association not getting created
That a very good question.

Maybe the problem is linked to issue 417.
Another possibility is that the Executor's connection is closed and the Executor is unable to get a new connection and fails silently.

But I think these cases would throw an exception instead of failing silently.

Christian

-----Message d'origine-----
De : mybatis-user@googlegroups.com [mailto:mybatis-user@googlegroups.com] De la part de Guy Rouillier
Envoyé : October-28-11 1:59 AM
À : mybatis-user@googlegroups.com
Objet : Re: Some objects with association not getting created

I tried a couple of settings in the config file to see if they would help:

        <settings>
                <setting name="lazyLoadingEnabled" value="false"/>
                <setting name="aggressiveLazyLoading" value="false"/>
        </settings>

Unfortunately, I still have the same problem, with both or either one of
the above settings enabled.  This is the first I'm aware that
associations have this problem.  We use them widely; hopefully they are
not causing hidden problems elsewhere.

Appreciate any ideas on getting this to work.  Thanks.

On 10/27/2011 3:12 AM, Guy Rouillier wrote:

--
Guy Rouillier

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Guy  
View profile  
 More options Nov 5 2011, 4:11 pm
From: Guy <g...@burntmail.com>
Date: Sat, 5 Nov 2011 13:11:40 -0700 (PDT)
Local: Sat, Nov 5 2011 4:11 pm
Subject: Re: Some objects with association not getting created
I've created an issue to track this problem.  Reproducible test case
is attached to the issue:

http://code.google.com/p/mybatis/issues/detail?id=433


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Guy Rouillier  
View profile  
 More options Nov 6 2011, 1:09 am
From: Guy Rouillier <g...@burntmail.com>
Date: Sun, 06 Nov 2011 01:09:50 -0400
Local: Sun, Nov 6 2011 1:09 am
Subject: Re: Some objects with association not getting created
I've made some progress in isolating this problem.  I think it may be
related to http://code.google.com/p/mybatis/issues/detail?id=263.  The
sample I attached to the issue is a command-line program, though the
real app is a web app.

I don't want to get into the extreme details present in the sample
attached to the issue I opened, but the object type I'm trying to
instantiate looks like this:

public class PairValue {
   private Date sampleDate = null;
   private double value = 0;

}

public class HubPairValue extends PairValue {
   private Hub sourceHub = null;
   private Hub destinationHub = null;

}

What is happening is that when the association creates a HubPairValue
using a constructor, that in turn creates a PairValue.  For the objects
that are not created, the sampleDate and value fields contain the same
values as a previous row, *even though* that row is for a different
combination of sourceHub and destinationHub.  That is causing the
PairValue object to not be created; and since the PairValue object is
not created, neither is HubPairValue.

I notice that (some of the) Hub objects that have been previously
created are also not created the next time the same hub appears in a
different row.  So apparently MyBatis is doing some kind of optimization
and not creating objects that it thinks already exist.  I tried turning
off the global cache, and also on the select statement specifying
useCache="false", but the outcome did not change.

This is a pretty basic problem; I'm surprised it hasn't surfaced already.

On 11/5/2011 4:11 PM, Guy wrote:

> I've created an issue to track this problem.  Reproducible test case
> is attached to the issue:

> http://code.google.com/p/mybatis/issues/detail?id=433

--
Guy Rouillier

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Guy Rouillier  
View profile  
 More options Nov 6 2011, 1:15 am
From: Guy Rouillier <g...@burntmail.com>
Date: Sun, 06 Nov 2011 01:15:45 -0400
Local: Sun, Nov 6 2011 1:15 am
Subject: Re: Some objects with association not getting created
Sorry, I'm tired, the first paragraph after the code snippet should read:

What is happening is that when the ResultMap creates a HubPairValue,
that in turn creates a PairValue.  For the objects that are not created,
the sampleDate and value fields contain the same values as a previous
row, *even though* that row is for a different combination of sourceHub
and destinationHub.  That is causing the PairValue object to not be
created; and since the PairValue object is not created, neither is
HubPairValue.

I don't know why commenting out the associations (which use constructors
to create sourceHub and destinationHub) results in all objects being
created.

On 11/6/2011 1:09 AM, Guy Rouillier wrote:

--
Guy Rouillier

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Guy  
View profile  
 More options Nov 6 2011, 2:14 am
From: Guy <g...@burntmail.com>
Date: Sun, 6 Nov 2011 00:14:26 -0700 (PDT)
Local: Sun, Nov 6 2011 2:14 am
Subject: Re: Some objects with association not getting created
I've found a workaround.  I got rid of the associations completely,
and added a TypeHandler for constructing the Hub object.  That allowed
me to change the resultMap for hubStatsMap to a simple set of four
column mappings, each of which is an "id" type.  Since all 4 are ids,
MyBatis requires each instance to be unique and is now no longer
discarding objects.

I would like to understand why this couldn't be done with
associations.  I guess that would require identifying the association
as being an "id" type, which isn't possible.

On Nov 6, 12:15 am, Guy Rouillier <g...@burntmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »