why is ibatis rolling up for an association, not sure why this isn't flat, or what its rolling up on?

2010-02-21 Thread Rick R
I'm now starting to get into using ibatis3 more and I'm curious about why a
'roll up' is happening (based on a column I didn't mention as a rollup
column) when I use an association. I'm sure it's something stupid I'm
missing but I don't see it.

For example this flat structure works just fine, and its what I've used in
ibatis2 for a simple flat structure:

resultMap id=ProdAttrGroupAttrValueResultWithAttributeValue
type=ProdAttrGroupAttrValue
result column=defaultValueFlag property=defaultValueFlag
jdbcType=CHAR /
result column=objectType property=objectType jdbcType=VARCHAR
/
result column=parentValueID property=parentValueID
jdbcType=INTEGER /
!-- the ProAttrGroupAttrValue has an attributeValue object
property: --
result property=attributeValue.attributeValueID
column=attributeValueID/
 result column=value property=attributeValue.value
jdbcType=VARCHAR/
 result column=attributeValueDesc
property=attributeValue.attributeValueDesc jdbcType=VARCHAR /
 result column=requiredFlag
property=attributeValue.requiredFlag jdbcType=CHAR /
 /resultMap

 But I thought I should follow ibatis3 conventions and use an association to
make it more clear:

resultMap id=ProdAttrGroupAttrValueResultWithAttributeValue
type=ProdAttrGroupAttrValue
result column=defaultValueFlag property=defaultValueFlag
jdbcType=CHAR /
result column=objectType property=objectType jdbcType=VARCHAR
/
result column=parentValueID property=parentValueID
jdbcType=INTEGER /
!-- using an association instead --
association property=attributeValue column=attributeValueID
javaType=AttributeValue
id property=attributeValueID column=attributeValueID/
result column=value property=value jdbcType=VARCHAR/
result column=attributeValueDesc
property=attributeValueDesc jdbcType=VARCHAR /
result column=requiredFlag property=requiredFlag
jdbcType=CHAR /
/association
/resultMap

However, when I use the latter association approach I end up getting rows
completely thrown out, but I'm not sure why and/or what logic its using.
The query returns 13 rows, but I only end up with 7 objects in the latter
association approach..


DEBUG [main] java.sql.PreparedStatement debug- == Parameters: 2(Integer),
12(Integer), 100(Integer)
DEBUG [main] java.sql.ResultSet debug- ==Columns: parentValueID,
objectType, defaultValueFlag, attributeValueID, value, attributeValueDesc,
requiredFlag
DEBUG [main] java.sql.ResultSet debug- ==Row: 15282, Checkbox, Y,
9042, AA, US AA %, N
DEBUG [main] java.sql.ResultSet debug- ==Row: 15282, Checkbox, N,
9043, GAA, US GAA %, N
DEBUG [main] java.sql.ResultSet debug- ==Row: 9043, Checkbox, N,
12059, nonOrderedGAATelecasts, Allow Non Ordered GAA, N
DEBUG [main] java.sql.ResultSet debug- ==Row: 15282, Checkbox, N,
12371, cvgAApercent, CVG AA %, N
DEBUG [main] java.sql.ResultSet debug- ==Row: 15282, Checkbox, N,
13260, cvgGAApercent, CVG GAA %, N
DEBUG [main] java.sql.ResultSet debug- ==Row: 12524, Checkbox, N,
9044, HUT/Share, US HUT/PUT and Share %, N
DEBUG [main] java.sql.ResultSet debug- ==Row: 12524, Checkbox, N,
9063, MAMI, Median Age / Median Income, N
DEBUG [main] java.sql.ResultSet debug- ==Row: 15298, Checkbox, N,
15299, indexP2, Index % P2+, N
DEBUG [main] java.sql.ResultSet debug- ==Row: 15298, Checkbox, N,
15304, CVG_Index_P18_plus, CVG Index % P18+, N
DEBUG [main] java.sql.ResultSet debug- ==Row: 12396, Checkbox, N,
12391, Commercial, National Commercial Statistics, N
DEBUG [main] java.sql.ResultSet debug- ==Row: 15284, Checkbox, N,
9064, RGL, Reach, Gain/Loss, N
DEBUG [main] java.sql.ResultSet debug- ==Row: 15284, Checkbox, N,
11135, vcrContribution, VCR Contribution, N
DEBUG [main] java.sql.ResultSet debug- ==Row: 15284, Checkbox, N,
11134, avgMinutesViewed, Average Minutes Viewed, N


13 rows but only 7 Objects using association:

DEBUG [main] com.nielsen.dataselector.media.service.TestAttributeGroup
testGetStatistics- TestAttributeGroup ProdAttrGroupAttrValue:
com.nielsen.dataselector.media.service.model.prodattrgroupattrva...@40e99ce5
[
  defaultValueFlag=Y
  objectType=Checkbox
  parentValueID=15282
  productID=null
  sequenceNumber=null

attributevalue=com.nielsen.dataselector.media.service.model.attributeva...@342f356f
[
  attributeValueDependencies=null
  attributeValueID=9042
  value=AA
  attributeValueDesc=US AA %
  requiredFlag=N
]
  attributeGroup=null
]
DEBUG [main] com.nielsen.dataselector.media.service.TestAttributeGroup
testGetStatistics- TestAttributeGroup ProdAttrGroupAttrValue:
com.nielsen.dataselector.media.service.model.prodattrgroupattrva...@75d252d[
  defaultValueFlag=N
  objectType=Checkbox
  parentValueID=15282
  productID=null
  sequenceNumber=null

attributevalue=com.nielsen.dataselector.media.service.model.attributeva...@7433b121
[
  

Re: why is ibatis rolling up for an association, not sure why this isn't flat, or what its rolling up on?

2010-02-21 Thread Clinton Begin
It rolls up by id elements, or if none exist, it rolls up by all columns
(which is why specifying an id is important).

Clinton

On Sun, Feb 21, 2010 at 5:55 PM, Rick R ric...@gmail.com wrote:

 I'm now starting to get into using ibatis3 more and I'm curious about why a
 'roll up' is happening (based on a column I didn't mention as a rollup
 column) when I use an association. I'm sure it's something stupid I'm
 missing but I don't see it.

 For example this flat structure works just fine, and its what I've used in
 ibatis2 for a simple flat structure:

 resultMap id=ProdAttrGroupAttrValueResultWithAttributeValue
 type=ProdAttrGroupAttrValue
 result column=defaultValueFlag property=defaultValueFlag
 jdbcType=CHAR /
 result column=objectType property=objectType
 jdbcType=VARCHAR /
 result column=parentValueID property=parentValueID
 jdbcType=INTEGER /
 !-- the ProAttrGroupAttrValue has an attributeValue object
 property: --
 result property=attributeValue.attributeValueID
 column=attributeValueID/
  result column=value property=attributeValue.value
 jdbcType=VARCHAR/
  result column=attributeValueDesc
 property=attributeValue.attributeValueDesc jdbcType=VARCHAR /
  result column=requiredFlag
 property=attributeValue.requiredFlag jdbcType=CHAR /
  /resultMap

  But I thought I should follow ibatis3 conventions and use an association
 to make it more clear:

 resultMap id=ProdAttrGroupAttrValueResultWithAttributeValue
 type=ProdAttrGroupAttrValue
 result column=defaultValueFlag property=defaultValueFlag
 jdbcType=CHAR /
 result column=objectType property=objectType
 jdbcType=VARCHAR /
 result column=parentValueID property=parentValueID
 jdbcType=INTEGER /
 !-- using an association instead --
 association property=attributeValue column=attributeValueID
 javaType=AttributeValue
 id property=attributeValueID column=attributeValueID/
 result column=value property=value jdbcType=VARCHAR/
 result column=attributeValueDesc
 property=attributeValueDesc jdbcType=VARCHAR /
 result column=requiredFlag property=requiredFlag
 jdbcType=CHAR /
 /association
 /resultMap

 However, when I use the latter association approach I end up getting rows
 completely thrown out, but I'm not sure why and/or what logic its using.
 The query returns 13 rows, but I only end up with 7 objects in the latter
 association approach..


 DEBUG [main] java.sql.PreparedStatement debug- == Parameters: 2(Integer),
 12(Integer), 100(Integer)
 DEBUG [main] java.sql.ResultSet debug- ==Columns: parentValueID,
 objectType, defaultValueFlag, attributeValueID, value, attributeValueDesc,
 requiredFlag
 DEBUG [main] java.sql.ResultSet debug- ==Row: 15282, Checkbox, Y,
 9042, AA, US AA %, N
 DEBUG [main] java.sql.ResultSet debug- ==Row: 15282, Checkbox, N,
 9043, GAA, US GAA %, N
 DEBUG [main] java.sql.ResultSet debug- ==Row: 9043, Checkbox, N,
 12059, nonOrderedGAATelecasts, Allow Non Ordered GAA, N
 DEBUG [main] java.sql.ResultSet debug- ==Row: 15282, Checkbox, N,
 12371, cvgAApercent, CVG AA %, N
 DEBUG [main] java.sql.ResultSet debug- ==Row: 15282, Checkbox, N,
 13260, cvgGAApercent, CVG GAA %, N
 DEBUG [main] java.sql.ResultSet debug- ==Row: 12524, Checkbox, N,
 9044, HUT/Share, US HUT/PUT and Share %, N
 DEBUG [main] java.sql.ResultSet debug- ==Row: 12524, Checkbox, N,
 9063, MAMI, Median Age / Median Income, N
 DEBUG [main] java.sql.ResultSet debug- ==Row: 15298, Checkbox, N,
 15299, indexP2, Index % P2+, N
 DEBUG [main] java.sql.ResultSet debug- ==Row: 15298, Checkbox, N,
 15304, CVG_Index_P18_plus, CVG Index % P18+, N
 DEBUG [main] java.sql.ResultSet debug- ==Row: 12396, Checkbox, N,
 12391, Commercial, National Commercial Statistics, N
 DEBUG [main] java.sql.ResultSet debug- ==Row: 15284, Checkbox, N,
 9064, RGL, Reach, Gain/Loss, N
 DEBUG [main] java.sql.ResultSet debug- ==Row: 15284, Checkbox, N,
 11135, vcrContribution, VCR Contribution, N
 DEBUG [main] java.sql.ResultSet debug- ==Row: 15284, Checkbox, N,
 11134, avgMinutesViewed, Average Minutes Viewed, N


 13 rows but only 7 Objects using association:

 DEBUG [main] com.nielsen.dataselector.media.service.TestAttributeGroup
 testGetStatistics- TestAttributeGroup ProdAttrGroupAttrValue:
 com.nielsen.dataselector.media.service.model.prodattrgroupattrva...@40e99ce5
 [
   defaultValueFlag=Y
   objectType=Checkbox
   parentValueID=15282
   productID=null
   sequenceNumber=null

 attributevalue=com.nielsen.dataselector.media.service.model.attributeva...@342f356f
 [
   attributeValueDependencies=null
   attributeValueID=9042
   value=AA
   attributeValueDesc=US AA %
   requiredFlag=N
 ]
   attributeGroup=null
 ]
 DEBUG [main] com.nielsen.dataselector.media.service.TestAttributeGroup
 testGetStatistics- TestAttributeGroup 

Re: why is ibatis rolling up for an association, not sure why this isn't flat, or what its rolling up on?

2010-02-21 Thread Rick R
On Sun, Feb 21, 2010 at 8:01 PM, Clinton Begin clinton.be...@gmail.comwrote:

 It rolls up by id elements, or if none exist, it rolls up by all columns
 (which is why specifying an id is important).


I did provide an id which adds to my confusion.

association property=attributeValue column=attributeValueID
javaType=AttributeValue
id property=attributeValueID column=attributeValueID/

The select is:

SELECT
 aga.parentValueID,
 aga.objectType,
 aga.defaultValueFlag,
 aga.attributeValueID,
 av.value,
 av.attributeValueDesc,
 av.requiredFlag
FROM



 Clinton


 On Sun, Feb 21, 2010 at 5:55 PM, Rick R ric...@gmail.com wrote:

 I'm now starting to get into using ibatis3 more and I'm curious about why
 a 'roll up' is happening (based on a column I didn't mention as a rollup
 column) when I use an association. I'm sure it's something stupid I'm
 missing but I don't see it.

 For example this flat structure works just fine, and its what I've used in
 ibatis2 for a simple flat structure:

 resultMap id=ProdAttrGroupAttrValueResultWithAttributeValue
 type=ProdAttrGroupAttrValue
 result column=defaultValueFlag property=defaultValueFlag
 jdbcType=CHAR /
 result column=objectType property=objectType
 jdbcType=VARCHAR /
 result column=parentValueID property=parentValueID
 jdbcType=INTEGER /
 !-- the ProAttrGroupAttrValue has an attributeValue object
 property: --
 result property=attributeValue.attributeValueID
 column=attributeValueID/
  result column=value property=attributeValue.value
 jdbcType=VARCHAR/
  result column=attributeValueDesc
 property=attributeValue.attributeValueDesc jdbcType=VARCHAR /
  result column=requiredFlag
 property=attributeValue.requiredFlag jdbcType=CHAR /
  /resultMap

  But I thought I should follow ibatis3 conventions and use an association
 to make it more clear:

 resultMap id=ProdAttrGroupAttrValueResultWithAttributeValue
 type=ProdAttrGroupAttrValue
 result column=defaultValueFlag property=defaultValueFlag
 jdbcType=CHAR /
 result column=objectType property=objectType
 jdbcType=VARCHAR /
 result column=parentValueID property=parentValueID
 jdbcType=INTEGER /
 !-- using an association instead --
 association property=attributeValue column=attributeValueID
 javaType=AttributeValue
 id property=attributeValueID column=attributeValueID/
 result column=value property=value jdbcType=VARCHAR/
 result column=attributeValueDesc
 property=attributeValueDesc jdbcType=VARCHAR /
 result column=requiredFlag property=requiredFlag
 jdbcType=CHAR /
 /association
 /resultMap

 However, when I use the latter association approach I end up getting rows
 completely thrown out, but I'm not sure why and/or what logic its using.
 The query returns 13 rows, but I only end up with 7 objects in the latter
 association approach..


 DEBUG [main] java.sql.PreparedStatement debug- == Parameters: 2(Integer),
 12(Integer), 100(Integer)
 DEBUG [main] java.sql.ResultSet debug- ==Columns: parentValueID,
 objectType, defaultValueFlag, attributeValueID, value, attributeValueDesc,
 requiredFlag
 DEBUG [main] java.sql.ResultSet debug- ==Row: 15282, Checkbox, Y,
 9042, AA, US AA %, N
 DEBUG [main] java.sql.ResultSet debug- ==Row: 15282, Checkbox, N,
 9043, GAA, US GAA %, N
 DEBUG [main] java.sql.ResultSet debug- ==Row: 9043, Checkbox, N,
 12059, nonOrderedGAATelecasts, Allow Non Ordered GAA, N
 DEBUG [main] java.sql.ResultSet debug- ==Row: 15282, Checkbox, N,
 12371, cvgAApercent, CVG AA %, N
 DEBUG [main] java.sql.ResultSet debug- ==Row: 15282, Checkbox, N,
 13260, cvgGAApercent, CVG GAA %, N
 DEBUG [main] java.sql.ResultSet debug- ==Row: 12524, Checkbox, N,
 9044, HUT/Share, US HUT/PUT and Share %, N
 DEBUG [main] java.sql.ResultSet debug- ==Row: 12524, Checkbox, N,
 9063, MAMI, Median Age / Median Income, N
 DEBUG [main] java.sql.ResultSet debug- ==Row: 15298, Checkbox, N,
 15299, indexP2, Index % P2+, N
 DEBUG [main] java.sql.ResultSet debug- ==Row: 15298, Checkbox, N,
 15304, CVG_Index_P18_plus, CVG Index % P18+, N
 DEBUG [main] java.sql.ResultSet debug- ==Row: 12396, Checkbox, N,
 12391, Commercial, National Commercial Statistics, N
 DEBUG [main] java.sql.ResultSet debug- ==Row: 15284, Checkbox, N,
 9064, RGL, Reach, Gain/Loss, N
 DEBUG [main] java.sql.ResultSet debug- ==Row: 15284, Checkbox, N,
 11135, vcrContribution, VCR Contribution, N
 DEBUG [main] java.sql.ResultSet debug- ==Row: 15284, Checkbox, N,
 11134, avgMinutesViewed, Average Minutes Viewed, N


 13 rows but only 7 Objects using association:

 DEBUG [main] com.nielsen.dataselector.media.service.TestAttributeGroup
 testGetStatistics- TestAttributeGroup ProdAttrGroupAttrValue:
 

Re: why is ibatis rolling up for an association, not sure why this isn't flat, or what its rolling up on?

2010-02-21 Thread Clinton Begin
Oh... also put an id element on the parent (likee parentValueID?).

Also, be careful with automapping and nested results.  In Beta 9 I added
configuration to disable automapping for nested results, only because it was
confusing where the results would end up.  But that doesn't look like a
problem here, as you don't have conflicting property names.

Clinton

On Sun, Feb 21, 2010 at 5:55 PM, Rick R ric...@gmail.com wrote:

 I'm now starting to get into using ibatis3 more and I'm curious about why a
 'roll up' is happening (based on a column I didn't mention as a rollup
 column) when I use an association. I'm sure it's something stupid I'm
 missing but I don't see it.

 For example this flat structure works just fine, and its what I've used in
 ibatis2 for a simple flat structure:

 resultMap id=ProdAttrGroupAttrValueResultWithAttributeValue
 type=ProdAttrGroupAttrValue
 result column=defaultValueFlag property=defaultValueFlag
 jdbcType=CHAR /
 result column=objectType property=objectType
 jdbcType=VARCHAR /
 result column=parentValueID property=parentValueID
 jdbcType=INTEGER /
 !-- the ProAttrGroupAttrValue has an attributeValue object
 property: --
 result property=attributeValue.attributeValueID
 column=attributeValueID/
  result column=value property=attributeValue.value
 jdbcType=VARCHAR/
  result column=attributeValueDesc
 property=attributeValue.attributeValueDesc jdbcType=VARCHAR /
  result column=requiredFlag
 property=attributeValue.requiredFlag jdbcType=CHAR /
  /resultMap

  But I thought I should follow ibatis3 conventions and use an association
 to make it more clear:

 resultMap id=ProdAttrGroupAttrValueResultWithAttributeValue
 type=ProdAttrGroupAttrValue
 result column=defaultValueFlag property=defaultValueFlag
 jdbcType=CHAR /
 result column=objectType property=objectType
 jdbcType=VARCHAR /
 result column=parentValueID property=parentValueID
 jdbcType=INTEGER /
 !-- using an association instead --
 association property=attributeValue column=attributeValueID
 javaType=AttributeValue
 id property=attributeValueID column=attributeValueID/
 result column=value property=value jdbcType=VARCHAR/
 result column=attributeValueDesc
 property=attributeValueDesc jdbcType=VARCHAR /
 result column=requiredFlag property=requiredFlag
 jdbcType=CHAR /
 /association
 /resultMap

 However, when I use the latter association approach I end up getting rows
 completely thrown out, but I'm not sure why and/or what logic its using.
 The query returns 13 rows, but I only end up with 7 objects in the latter
 association approach..


 DEBUG [main] java.sql.PreparedStatement debug- == Parameters: 2(Integer),
 12(Integer), 100(Integer)
 DEBUG [main] java.sql.ResultSet debug- ==Columns: parentValueID,
 objectType, defaultValueFlag, attributeValueID, value, attributeValueDesc,
 requiredFlag
 DEBUG [main] java.sql.ResultSet debug- ==Row: 15282, Checkbox, Y,
 9042, AA, US AA %, N
 DEBUG [main] java.sql.ResultSet debug- ==Row: 15282, Checkbox, N,
 9043, GAA, US GAA %, N
 DEBUG [main] java.sql.ResultSet debug- ==Row: 9043, Checkbox, N,
 12059, nonOrderedGAATelecasts, Allow Non Ordered GAA, N
 DEBUG [main] java.sql.ResultSet debug- ==Row: 15282, Checkbox, N,
 12371, cvgAApercent, CVG AA %, N
 DEBUG [main] java.sql.ResultSet debug- ==Row: 15282, Checkbox, N,
 13260, cvgGAApercent, CVG GAA %, N
 DEBUG [main] java.sql.ResultSet debug- ==Row: 12524, Checkbox, N,
 9044, HUT/Share, US HUT/PUT and Share %, N
 DEBUG [main] java.sql.ResultSet debug- ==Row: 12524, Checkbox, N,
 9063, MAMI, Median Age / Median Income, N
 DEBUG [main] java.sql.ResultSet debug- ==Row: 15298, Checkbox, N,
 15299, indexP2, Index % P2+, N
 DEBUG [main] java.sql.ResultSet debug- ==Row: 15298, Checkbox, N,
 15304, CVG_Index_P18_plus, CVG Index % P18+, N
 DEBUG [main] java.sql.ResultSet debug- ==Row: 12396, Checkbox, N,
 12391, Commercial, National Commercial Statistics, N
 DEBUG [main] java.sql.ResultSet debug- ==Row: 15284, Checkbox, N,
 9064, RGL, Reach, Gain/Loss, N
 DEBUG [main] java.sql.ResultSet debug- ==Row: 15284, Checkbox, N,
 11135, vcrContribution, VCR Contribution, N
 DEBUG [main] java.sql.ResultSet debug- ==Row: 15284, Checkbox, N,
 11134, avgMinutesViewed, Average Minutes Viewed, N


 13 rows but only 7 Objects using association:

 DEBUG [main] com.nielsen.dataselector.media.service.TestAttributeGroup
 testGetStatistics- TestAttributeGroup ProdAttrGroupAttrValue:
 com.nielsen.dataselector.media.service.model.prodattrgroupattrva...@40e99ce5
 [
   defaultValueFlag=Y
   objectType=Checkbox
   parentValueID=15282
   productID=null
   sequenceNumber=null

 attributevalue=com.nielsen.dataselector.media.service.model.attributeva...@342f356f
 [
   attributeValueDependencies=null
   

Re: why is ibatis rolling up for an association, not sure why this isn't flat, or what its rolling up on?

2010-02-21 Thread Rick R
On Sun, Feb 21, 2010 at 10:50 PM, Clinton Begin clinton.be...@gmail.comwrote:

 Oh... also put an id element on the parent (likee parentValueID?).


Ok that's even more weird now. When I changed:

result column=parentValueID property=parentValueID jdbcType=INTEGER
/
to
id property=parentValueID column=parentValueID jdbcType=INTEGER/

I now end up with 6 of the rows mapped to objects (instead of 7 without it
.. and remember there should be 13 objects total.)



 Also, be careful with automapping and nested results.  In Beta 9 I added
 configuration to disable automapping for nested results, only because it was
 confusing where the results would end up.  But that doesn't look like a
 problem here, as you don't have conflicting property names.


I'm curious what part I'm automapping? I thought I was doing it just as I
saw in your blog example in the PDF?

I even changed it a bit to be more like your example (not that in my case
I'd think I would need to get the value of attributeValueID more than once.)

SELECT
 aga.parentValueID,
 aga.objectType,
 aga.defaultValueFlag,
 aga.attributeValueID as parent_avID,
 av.attributeValueID,
 av.value,
 av.attributeValueDesc,
 av.requiredFlag
FROM

  resultMap id=ProdAttrGroupAttrValueResultWithAttributeValue
type=ProdAttrGroupAttrValue
id property=parentValueID column=parentValueID
jdbcType=INTEGER/
result column=defaultValueFlag property=defaultValueFlag
jdbcType=CHAR /
result column=objectType property=objectType jdbcType=VARCHAR
/
!--result column=parentValueID property=parentValueID
jdbcType=INTEGER /  --
association property=attributeValue column=parent_avID
javaType=AttributeValue
id property=attributeValueID column=attributeValueID
jdbcType=INTEGER/
result column=value property=value jdbcType=VARCHAR/
result column=attributeValueDesc
property=attributeValueDesc jdbcType=VARCHAR /
result column=requiredFlag property=requiredFlag
jdbcType=CHAR /
/association
/resultMap

To Guy's point, not sure if the object's I'm mapping to matter? but if so:

public class ProdAttrGroupAttrValue extends BaseModel {
private String defaultValueFlag;
private String objectType;
private Integer parentValueID;
private Integer productID;
private Integer sequenceNumber;

private AttributeValue attributeValue; //the association object I'm
trying to populate

private AttributeGroup attributeGroup; //not used here
//...set/gets

public class AttributeValue extends BaseModel {
private ListAttributeValue attributeValueDependencies; //not used here
in this query
private Integer attributeValueID;
private String value;
private String attributeValueDesc;
private String requiredFlag;
//... set/gets

I'm sure this is going to come down to a typo or something. I can just feel
it, because it seems like I'm doing things correctly?


Re: why is ibatis rolling up for an association, not sure why this isn't flat, or what its rolling up on?

2010-02-21 Thread Guy Rouillier

On 2/21/2010 11:19 PM, Rick R wrote:


To Guy's point, not sure if the object's I'm mapping to matter? but if so:


Objects look fine.  How are you storing the collection of objects?  As a 
List?  Because if you are storing a Hashmap, that may explain some 
missing objects.


--
Guy Rouillier

-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: why is ibatis rolling up for an association, not sure why this isn't flat, or what its rolling up on?

2010-02-21 Thread Rick R
On Sun, Feb 21, 2010 at 11:26 PM, Guy Rouillier guyr-...@burntmail.comwrote:

 On 2/21/2010 11:19 PM, Rick R wrote:

  To Guy's point, not sure if the object's I'm mapping to matter? but if so:


 Objects look fine.  How are you storing the collection of objects?  As a
 List?  Because if you are storing a Hashmap, that may explain some missing
 objects.



Returning them as a List

 ListProdAttrGroupAttrValue
findProdAttrGroupAttrValues(@Param(productID) Integer productID,
@Param(attributeGroupID) Integer attributeGroupID, @Param(sampleTypeKey)
Integer sampleTypeKey);


Re: why is ibatis rolling up for an association, not sure why this isn't flat, or what its rolling up on?

2010-02-21 Thread Guy Rouillier

On 2/21/2010 11:19 PM, Rick R wrote:


To Guy's point, not sure if the object's I'm mapping to matter? but if so:

public class ProdAttrGroupAttrValue extends BaseModel {
public class AttributeValue extends BaseModel {


After sending my last reply, I noticed both your object classes extend 
BaseModel.  What is that?  As a test, I'd suggest removing this 
derivation to ensure that the base class is not doing things to trip you 
up.  One BaseModel I've used is from GXT and that definitely has some 
restrictions on how it is used.


--
Guy Rouillier

-
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org



Re: why is ibatis rolling up for an association, not sure why this isn't flat, or what its rolling up on?

2010-02-21 Thread Rick R
BaseModel just has some utility things mostly for XStream (I do also have
XStream annotations on my model classes, but I wouldn't think that should
mess up ibatis?)

BaseModel:

@Override
public String toString() {
return ToStringBuilder.reflectionToString(this,
ToStringStyle.MULTI_LINE_STYLE);
}

public static T extends BaseModel T createObjectFromXStream(File
aFile,
Class className) throws Exception {
XStream stream = new XStream(new DomDriver());
stream.processAnnotations(className);
BufferedReader input = new BufferedReader(new FileReader(aFile));
return (T) stream.fromXML(input);
}

public static T extends BaseModel T createObjectFromXStream(
InputStream istream, Class className) throws Exception {
XStream stream = new XStream(new DomDriver());
stream.processAnnotations(className);
return (T) stream.fromXML(istream);
}




On Sun, Feb 21, 2010 at 11:36 PM, Guy Rouillier guyr-...@burntmail.comwrote:

 On 2/21/2010 11:19 PM, Rick R wrote:

  To Guy's point, not sure if the object's I'm mapping to matter? but if so:

 public class ProdAttrGroupAttrValue extends BaseModel {
 public class AttributeValue extends BaseModel {


 After sending my last reply, I noticed both your object classes extend
 BaseModel.  What is that?  As a test, I'd suggest removing this derivation
 to ensure that the base class is not doing things to trip you up.  One
 BaseModel I've used is from GXT and that definitely has some restrictions on
 how it is used.


 --
 Guy Rouillier

 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org




-- 
Rick R


Re: why is ibatis rolling up for an association, not sure why this isn't flat, or what its rolling up on?

2010-02-21 Thread Rick R
And those static methods will be moved to a Helper file:) it's not my code:)

On Sun, Feb 21, 2010 at 11:43 PM, Rick R ric...@gmail.com wrote:

 BaseModel just has some utility things mostly for XStream (I do also have
 XStream annotations on my model classes, but I wouldn't think that should
 mess up ibatis?)

 BaseModel:

 @Override
 public String toString() {
 return ToStringBuilder.reflectionToString(this,
 ToStringStyle.MULTI_LINE_STYLE);
 }

 public static T extends BaseModel T createObjectFromXStream(File
 aFile,
 Class className) throws Exception {
 XStream stream = new XStream(new DomDriver());
 stream.processAnnotations(className);
 BufferedReader input = new BufferedReader(new FileReader(aFile));
 return (T) stream.fromXML(input);
 }

 public static T extends BaseModel T createObjectFromXStream(
 InputStream istream, Class className) throws Exception {
 XStream stream = new XStream(new DomDriver());
 stream.processAnnotations(className);
 return (T) stream.fromXML(istream);

 }




 On Sun, Feb 21, 2010 at 11:36 PM, Guy Rouillier guyr-...@burntmail.comwrote:

 On 2/21/2010 11:19 PM, Rick R wrote:

  To Guy's point, not sure if the object's I'm mapping to matter? but if
 so:

 public class ProdAttrGroupAttrValue extends BaseModel {
 public class AttributeValue extends BaseModel {


 After sending my last reply, I noticed both your object classes extend
 BaseModel.  What is that?  As a test, I'd suggest removing this derivation
 to ensure that the base class is not doing things to trip you up.  One
 BaseModel I've used is from GXT and that definitely has some restrictions on
 how it is used.


 --
 Guy Rouillier

 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org




 --
 Rick R




-- 
Rick R


Re: why is ibatis rolling up for an association, not sure why this isn't flat, or what its rolling up on?

2010-02-21 Thread Clinton Begin
The reason is that the rows aren't uniquely identified.  Upon a second look,
I see that the column I recommended isn't unique.  Which columns uniquely
identify each parent row?

On Sun, Feb 21, 2010 at 9:50 PM, Rick R ric...@gmail.com wrote:

 And those static methods will be moved to a Helper file:) it's not my
 code:)


 On Sun, Feb 21, 2010 at 11:43 PM, Rick R ric...@gmail.com wrote:

 BaseModel just has some utility things mostly for XStream (I do also have
 XStream annotations on my model classes, but I wouldn't think that should
 mess up ibatis?)

 BaseModel:

 @Override
 public String toString() {
 return ToStringBuilder.reflectionToString(this,
 ToStringStyle.MULTI_LINE_STYLE);
 }

 public static T extends BaseModel T createObjectFromXStream(File
 aFile,
 Class className) throws Exception {
 XStream stream = new XStream(new DomDriver());
 stream.processAnnotations(className);
 BufferedReader input = new BufferedReader(new FileReader(aFile));
 return (T) stream.fromXML(input);
 }

 public static T extends BaseModel T createObjectFromXStream(
 InputStream istream, Class className) throws Exception {
 XStream stream = new XStream(new DomDriver());
 stream.processAnnotations(className);
 return (T) stream.fromXML(istream);

 }




 On Sun, Feb 21, 2010 at 11:36 PM, Guy Rouillier 
 guyr-...@burntmail.comwrote:

 On 2/21/2010 11:19 PM, Rick R wrote:

  To Guy's point, not sure if the object's I'm mapping to matter? but if
 so:

 public class ProdAttrGroupAttrValue extends BaseModel {
 public class AttributeValue extends BaseModel {


 After sending my last reply, I noticed both your object classes extend
 BaseModel.  What is that?  As a test, I'd suggest removing this derivation
 to ensure that the base class is not doing things to trip you up.  One
 BaseModel I've used is from GXT and that definitely has some restrictions on
 how it is used.


 --
 Guy Rouillier

 -
 To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
 For additional commands, e-mail: user-java-h...@ibatis.apache.org




 --
 Rick R




 --
 Rick R



Re: why is ibatis rolling up for an association, not sure why this isn't flat, or what its rolling up on?

2010-02-21 Thread Rick R
On Mon, Feb 22, 2010 at 12:03 AM, Clinton Begin clinton.be...@gmail.comwrote:

 The reason is that the rows aren't uniquely identified.  Upon a second
 look, I see that the column I recommended isn't unique.  Which columns
 uniquely identify each parent row?



They'd be unique by a combination of parentAttributeID and
attributeValueID

That would make a row unique. So your post led me to try this

association property=attributeValue
column={parentValueID=parentValueID,attributeValue.attributeValueID=attributeValueID}
- but that would only work I suppose if my property was a composite object
which its not.

Looks like I should stick to not using an association for this (and do it
the ibatis2.0 way?):

!-- flatten --
result property=parentValueID column=parentValueID jdbcType=CHAR /
result property=attributeValue.attributeValueID column=attributeValueID
jdbcType=INTEGER/
result column=value property=attributeValue.value jdbcType=VARCHAR/