java - Mybatis not able to perform query and map to apt Model class -


i have model class holds foreign keys 2 other tables. :

create table `toolosrelation` (   `tooltype` varchar(100) not null default '',   `osname` varchar(50) not null default '',   primary key (`tooltype`,`osname`),   key `osname` (`osname`),   constraint `toolosrelation_ibfk_1` foreign key (`tooltype`) references `tools` (`tooltype`),   constraint `toolosrelation_ibfk_2` foreign key (`osname`) references `os` (`osname`) ) 

correspondingly have following model class toolosrelation.java :

public class toolosrelation {      private tools tooltype;     private os osname;      public toolosrelation() {      } //remaining getters , setters here 

after this, have following mybatis mapper :

<mapper namespace="com.dexter.devicetype.toolosrelationdao">     <select id="gettoolsforos" resultmap="toolosrelationmap" parametertype="string">         select             t.tooltype                     toolosrelation t         left join             os o         on             t.osname=o.osname                     o.osname=#{osname}     </select>      <resultmap id="toolosrelationmap" type="toolosrelation">  <association property="tooltype" javatype="tools">      <result property="tooltype" column="tooltype" jdbctype="varchar"/>  </association>  <association property="osname" javatype="os">     <result property="osname" column="osname" jdbctype="varchar" /> </association> </mapper> 

javatype="os" points file os.java , "tools" points tools.java.

the query works fine when run in mysql shell. however, returns me single object of toolosrelation values (tools , os) null. going wrong?

edit : adding tools class , os class :

public class tools {      private string tooltype;     private list<template> template;     private list<toolosrelation> osname;      public tools() {}     }     public tools(string tooltype) {          this.tooltype =tooltype;     }      public string gettooltype() {         return tooltype;     }      public void settooltype(string tooltype) {         this.tooltype = tooltype;     }     public list<template> gettemplate() {         return template;     }     public void settemplate(list<template> template) {         this.template = template;     }      public list<toolosrelation> getosname() {         return osname;     }     public void setosname(list<toolosrelation> osname) {         osname = osname;     }  }  public class os {      private string osname;     private list<devicetype> devicetype;     private list<toolosrelation> tooltype;      public os() {     }      public os(string osname) {         this.osname = osname;     }      public string getosname() {         return osname;     }      public void setosname(string osname) {         osname = osname;     }     public list<devicetype> getdevicetype() {         return devicetype;     }      public void setdevicetype(list<devicetype> devicetype) {         this.devicetype = devicetype;     }     public list<toolosrelation> gettooltype() {         return tooltype;     }      public void settooltype(list<toolosrelation> tooltype) {         this.tooltype = tooltype;     } } 

i suppose mybatis cant find inflected properties, have checked setters , getter in model class.


Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -