Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 51283 invoked from network); 1 Aug 2007 01:34:50 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 1 Aug 2007 01:34:50 -0000 Received: (qmail 60812 invoked by uid 500); 1 Aug 2007 01:34:48 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 60801 invoked by uid 500); 1 Aug 2007 01:34:47 -0000 Mailing-List: contact user-java-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user-java@ibatis.apache.org Delivered-To: mailing list user-java@ibatis.apache.org Received: (qmail 60790 invoked by uid 99); 1 Aug 2007 01:34:47 -0000 Received: from Unknown (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 31 Jul 2007 18:34:47 -0700 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of froast@gmail.com designates 209.85.198.187 as permitted sender) Received: from [209.85.198.187] (HELO rv-out-0910.google.com) (209.85.198.187) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 Aug 2007 01:34:45 +0000 Received: by rv-out-0910.google.com with SMTP id c27so38239rvf for ; Tue, 31 Jul 2007 18:34:24 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type; b=H3Ivz7J1uInBRpRRnvB9jvP7Uxo0fwUDQwamGAkiNGbhrb07Xvg3qhXR+KVPtfFpoSGTMldFwAyWggGy1wWBbvs6H2rmLEYuSTp0+Znx6cZwESLCyfZh+DQPE3moxgmImFQ8p+/avdyVDTYV2PIyO7fO8xKD6tF31Y/qVOP1BxQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:mime-version:content-type; b=LYFCY6hycENdpTDDaQwSOMl76v5ojUsaYKLrMKDfOQBXODoqWDoXA9nWP8b4ozr8U4JKGJIz/iLEBHbJxDEf4eBwF4HiFggJLLgCNtBfWc8WWhmYI0al9TaQturhexAZx/RN5W4qeHAwSLqVPnEdwgufTUmMVX7MygSFdJ/0KtY= Received: by 10.115.32.1 with SMTP id k1mr191044waj.1185932063438; Tue, 31 Jul 2007 18:34:23 -0700 (PDT) Received: by 10.114.92.7 with HTTP; Tue, 31 Jul 2007 18:34:23 -0700 (PDT) Message-ID: Date: Wed, 1 Aug 2007 09:34:23 +0800 From: "=?GB2312?B?1tPUrWZyb2FzdA==?=" To: user-java@ibatis.apache.org Subject: [ibatis2]can I use a class with inner classes as resultMap? MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_48882_9197381.1185932063382" X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_48882_9197381.1185932063382 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline hi, I have a class like this: package com.gehouse.bean.ge; public class GEElementStyleBean { public class IconStyle { int id; float scale; boolean transparent; public int getId() { return id; } public void setId(int id) { this.id = id; } public float getScale() { return scale; } public void setScale(float scale) { this.scale = scale; } public boolean isTransparent() { return transparent; } public void setTransparent(boolean transparent) { this.transparent = transparent; } } public class LableStyle { String color; float scale; public String getColor() { return color; } public void setColor(String color) { this.color = color; } public float getScale() { return scale; } public void setScale(float scale) { this.scale = scale; } } public class LineStyle { String color; float scale; public String getColor() { return color; } public void setColor(String color) { this.color = color; } public float getScale() { return scale; } public void setScale(float scale) { this.scale = scale; } } private IconStyle iconStyle; private LableStyle lableStyle; private LineStyle lineStyle; public IconStyle getIconStyle() { return iconStyle; } public void setIconStyle(IconStyle iconStyle) { this.iconStyle = iconStyle; } public LableStyle getLableStyle() { return lableStyle; } public void setLableStyle(LableStyle lableStyle) { this.lableStyle = lableStyle; } public LineStyle getLineStyle() { return lineStyle; } public void setLineStyle(LineStyle lineStyle) { this.lineStyle = lineStyle; } } ----------------------------------------------------------------------------------------------------------------- and result map like this: -------------------------------------------------------------------------------------------------------------- but it throws exceptions, saying that normalStyle.iconStyle is null, all the inner class objects are null, the ibatis can't initialize the object. is there any solutions? any help would be appreciated. ------=_Part_48882_9197381.1185932063382 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline
hi, I have a class like this:

package com.gehouse.bean.ge;

public class GEElementStyleBean {

 
 public class IconStyle {
  int id;
  float scale;
  boolean transparent;
  public int getId() {
   return id;
  }
  public void setId(int id) {
   this.id = id;
  }
  public float getScale() {
   return scale;
  }
  public void setScale(float scale) {
   this.scale = scale;
  }
  public boolean isTransparent() {
   return transparent;
  }
  public void setTransparent(boolean transparent) {
   this.transparent = transparent;
  }
 }
 
 public class LableStyle {
  String color;
  float scale;
  public String getColor() {
   return color;
  }
  public void setColor(String color) {
   this.color = color;
  }
  public float getScale() {
   return scale;
  }
  public void setScale(float scale) {
   this.scale = scale;
  }
 }
 
 public class LineStyle {
  String color;
  float scale;
  public String getColor() {
   return color;
  }
  public void setColor(String color) {
   this.color = color;
  }
  public float getScale() {
   return scale;
  }
  public void setScale(float scale) {
   this.scale = scale;
  }
 }
 
 private IconStyle iconStyle;
 private LableStyle lableStyle;
 private LineStyle lineStyle;
 
 public IconStyle getIconStyle() {
  return iconStyle;
 }
 
 public void setIconStyle(IconStyle iconStyle) {
  this.iconStyle = iconStyle;
 }
 
 public LableStyle getLableStyle() {
  return lableStyle;
 }
 
 public void setLableStyle(LableStyle lableStyle) {
  this.lableStyle = lableStyle;
 }
 
 public LineStyle getLineStyle() {
  return lineStyle;
 }
 
 public void setLineStyle(LineStyle lineStyle) {
  this.lineStyle = lineStyle;
 } 
}
-----------------------------------------------------------------------------------------------------------------

and result map like this:

<typeAlias alias="GEStyle" type="com.gehouse.bean.ge.GEElementStyleMapBean"></typeAlias>
 <typeAlias alias="GEElementStyle" type="com.gehouse.bean.ge.GEElementStyleBean "></typeAlias>
 
 <resultMap id="GEStyleResultMap" class="GEStyle">
   <result property="id" column="id"/>
   <result property="name" column="name"/>
   
   <result property="normalStyle.iconStyle.id" column="nomal_icon_id"/>
   <result property="normalStyle.iconStyle.scale" column="normal_icon_scale"/>
   <result property="normalStyle.iconStyle.transparent" column="normal_icon_transprent"/>
   <result property="normalStyle.lableStyle.color" column="normal_label_color"/>
   <result property="normalStyle.lableStyle.scale" column="normal_label_scale"/>
   <result property="normalStyle.lineStyle.color" column="normal_line_color"/>
   <result property="normalStyle.lineStyle.scale" column="normal_line_width"/>
   
   <result property="highlightStyle.iconStyle.id" column="highlight_icon_id"/>
   <result property="highlightStyle.iconStyle.scale" column="highlight_icon_scale"/>
   <result property="highlightStyle.iconStyle.transparent" column="highlight_icon_transprent"/>
   <result property="highlightStyle.lableStyle.color" column="highlight_label_color"/>
   <result property="highlightStyle.lableStyle.scale" column="highlight_label_scale"/>
   <result property="highlightStyle.lineStyle.color" column="highlight_line_color"/>
   <result property="highlightStyle.lineStyle.scale" column="highlight_line_width"/>
  
  </resultMap>

--------------------------------------------------------------------------------------------------------------

but it throws exceptions, saying that normalStyle.iconStyle is null, all the inner class objects are null, the ibatis can't initialize the object.

is there any solutions? any help would be appreciated.

------=_Part_48882_9197381.1185932063382--