ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nathan Maves <Nathan.Ma...@Sun.COM>
Subject Re: Some problem with the <insert> tag
Date Wed, 03 May 2006 15:48:09 GMT
This is a common problem.  You need to understand how ibatis maps the  
properties of an object.  It uses the java bean specification.

I would try and change your map to look like....

<insert id="getPerson1" parameterClass="com.dwrtest.model.Employee" >
         insert into Test_Emp
         		(NAME, EMPNO)
         values(#name#,#empNo#)
</insert>


Notice the lower case on the "Name" and "EmpNo".

A side note ....

Watch how you manage your transaction.  In this case if the sql threw  
an exception the transaction would hang.  Make sure that you rollBack  
the XA in the catch block.


On May 3, 2006, at 9:36 AM, Akhil Kodali wrote:

> Hi,
>
> I'm trying to use iBATIS over weblogic 8.1.
> I've attached the files.
>
> Sorry for sending so many attachments.
>
> The output error message is:
>
> ===========================================================
> Caused by:
> com.ibatis.common.beans.ProbeException: There is no READABLE  
> property named 'Name' in class 'com.dwrtest.model.Employee'
>         at com.ibatis.common.beans.ClassInfo.getGetterType 
> (ClassInfo.java:188)
>         at  
> com.ibatis.common.beans.GenericProbe.getClassPropertyTypeForGetter(Ge
> nericProbe.java:226)
>         at  
> com.ibatis.common.beans.GenericProbe.getPropertyTypeForGetter(Generic
> Probe.java:155)
>         at  
> com.ibatis.sqlmap.engine.mapping.parameter.InlineParameterMapParser.r
> esolveTypeHandler(InlineParameterMapParser.java:212)
>         at  
> com.ibatis.sqlmap.engine.mapping.parameter.InlineParameterMapParser.n
> ewParseMapping( InlineParameterMapParser.java:121)
>         at  
> com.ibatis.sqlmap.engine.mapping.parameter.InlineParameterMapParser.p
> arseInlineParameterMap(InlineParameterMapParser.java:50)
>         at  
> com.ibatis.sqlmap.engine.builder.xml.SqlStatementParser.applyInlinePa
> rameterMap(SqlStatementParser.java:377)
>         at  
> com.ibatis.sqlmap.engine.builder.xml.SqlStatementParser.processSqlSta
> tement(SqlStatementParser.java:185)
>         at  
> com.ibatis.sqlmap.engine.builder.xml.SqlStatementParser.parseGeneralS
> tatement(SqlStatementParser.java:139)
>         at com.ibatis.sqlmap.engine.builder.xml.SqlMapParser 
> $19.process(SqlMapPa
> rser.java:516)
>         at com.ibatis.common.xml.NodeletParser.processNodelet 
> (NodeletParser.java
> :112)
>         at com.ibatis.common.xml.NodeletParser.process 
> (NodeletParser.java:75)
>         at com.ibatis.common.xml.NodeletParser.process 
> (NodeletParser.java:93)
>         at com.ibatis.common.xml.NodeletParser.parse  
> (NodeletParser.java:63)
>         at com.ibatis.common.xml.NodeletParser.parse 
> (NodeletParser.java:51)
>         at com.ibatis.sqlmap.engine.builder.xml.SqlMapParser.parse 
> (SqlMapParser.
> java:45)
>         at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser 
> $11.process (Sq
> lMapConfigParser.java:347)
>         at com.ibatis.common.xml.NodeletParser.processNodelet 
> (NodeletParser.java
> :112)
>         at com.ibatis.common.xml.NodeletParser.process 
> (NodeletParser.java:75)
>         at com.ibatis.common.xml.NodeletParser.process 
> (NodeletParser.java:93)
>         at com.ibatis.common.xml.NodeletParser.parse 
> (NodeletParser.java:63)
>         at com.ibatis.common.xml.NodeletParser.parse 
> (NodeletParser.java:51)
>         at  
> com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapC
> onfigParser.java:78)
>         at  
> com.ibatis.sqlmap.client.SqlMapClientBuilder.buildSqlMapClient(SqlMap
> ClientBuilder.java:62)
>         at com.dwrtest.util.SqlClient.<clinit>(SqlClient.java:16)
>         at com.dwrtest.util.EmployeeDAO.execute(EmployeeDAO.java:13)
>         at jsp_servlet._pages.__test._jspService(__test.java:131)
>         at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
>         at weblogic.servlet.internal.ServletStubImpl 
> $ServletInvocationAction.run
> (ServletStubImpl.java:1006)
>         at weblogic.servlet.internal.ServletStubImpl.invokeServlet  
> (ServletStubIm
> pl.java:419)
>         at weblogic.servlet.internal.ServletStubImpl.invokeServlet 
> (ServletStubIm
> pl.java:463)
>         at weblogic.servlet.internal.ServletStubImpl.invokeServlet 
> (ServletStubIm
> pl.java :315)
>         at weblogic.servlet.internal.WebAppServletContext 
> $ServletInvocationActio
> n.run(WebAppServletContext.java:6718)
>         at weblogic.security.acl.internal.AuthenticatedSubject.doAs 
> (Authenticate
> dSubject.java :321)
>         at weblogic.security.service.SecurityManager.runAs 
> (SecurityManager.java:
> 121)
>         at  
> weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
> rvletContext.java:3764)
>         at weblogic.servlet.internal.ServletRequestImpl.execute 
> (ServletRequestIm
> pl.java:2644)
>         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java: 
> 219)
>         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java :178)
>
> Caused by:
> com.ibatis.common.exception.NestedRuntimeException: Error parsing  
> XPath '/sqlMap
> /insert'.  Cause: com.ibatis.common.beans.ProbeException: There is  
> no READABLE p
> roperty named 'Name' in class ' com.dwrtest.model.Employee'
> Caused by: com.ibatis.common.beans.ProbeException: There is no  
> READABLE property
>  named 'Name' in class 'com.dwrtest.model.Employee'
>         at com.ibatis.common.xml.NodeletParser.processNodelet  
> (NodeletParser.java
> :114)
>         at com.ibatis.common.xml.NodeletParser.process 
> (NodeletParser.java:75)
>         at com.ibatis.common.xml.NodeletParser.process 
> (NodeletParser.java:93)
>         at com.ibatis.common.xml.NodeletParser.parse  
> (NodeletParser.java:63)
>         at com.ibatis.common.xml.NodeletParser.parse 
> (NodeletParser.java:51)
>         at com.ibatis.sqlmap.engine.builder.xml.SqlMapParser.parse 
> (SqlMapParser.
> java:45)
>         at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser 
> $11.process (Sq
> lMapConfigParser.java:347)
>         at com.ibatis.common.xml.NodeletParser.processNodelet 
> (NodeletParser.java
> :112)
>         at com.ibatis.common.xml.NodeletParser.process 
> (NodeletParser.java:75)
>         at com.ibatis.common.xml.NodeletParser.process 
> (NodeletParser.java:93)
>         at com.ibatis.common.xml.NodeletParser.parse 
> (NodeletParser.java:63)
>         at com.ibatis.common.xml.NodeletParser.parse 
> (NodeletParser.java:51)
>         at  
> com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapC
> onfigParser.java:78)
>         at  
> com.ibatis.sqlmap.client.SqlMapClientBuilder.buildSqlMapClient(SqlMap
> ClientBuilder.java:62)
>         at com.dwrtest.util.SqlClient.<clinit>(SqlClient.java:16)
>         at com.dwrtest.util.EmployeeDAO.execute(EmployeeDAO.java:13)
>         at jsp_servlet._pages.__test._jspService(__test.java:131)
>         at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
>         at weblogic.servlet.internal.ServletStubImpl 
> $ServletInvocationAction.run
> (ServletStubImpl.java:1006)
>         at weblogic.servlet.internal.ServletStubImpl.invokeServlet  
> (ServletStubIm
> pl.java:419)
>         at weblogic.servlet.internal.ServletStubImpl.invokeServlet 
> (ServletStubIm
> pl.java:463)
>         at weblogic.servlet.internal.ServletStubImpl.invokeServlet 
> (ServletStubIm
> pl.java :315)
>         at weblogic.servlet.internal.WebAppServletContext 
> $ServletInvocationActio
> n.run(WebAppServletContext.java:6718)
>         at weblogic.security.acl.internal.AuthenticatedSubject.doAs 
> (Authenticate
> dSubject.java :321)
>         at weblogic.security.service.SecurityManager.runAs 
> (SecurityManager.java:
> 121)
>         at  
> weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
> rvletContext.java:3764)
>         at weblogic.servlet.internal.ServletRequestImpl.execute 
> (ServletRequestIm
> pl.java:2644)
>         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java: 
> 219)
>         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java :178)
> Caused by: com.ibatis.common.beans.ProbeException: There is no  
> READABLE property
>  named 'Name' in class 'com.dwrtest.model.Employee'
>         at com.ibatis.common.beans.ClassInfo.getGetterType 
> (ClassInfo.java :188)
>         at  
> com.ibatis.common.beans.GenericProbe.getClassPropertyTypeForGetter(Ge
> nericProbe.java:226)
>         at  
> com.ibatis.common.beans.GenericProbe.getPropertyTypeForGetter(Generic
> Probe.java:155)
>         at  
> com.ibatis.sqlmap.engine.mapping.parameter.InlineParameterMapParser.r
> esolveTypeHandler(InlineParameterMapParser.java:212)
>         at  
> com.ibatis.sqlmap.engine.mapping.parameter.InlineParameterMapParser.n
> ewParseMapping( InlineParameterMapParser.java:121)
>         at  
> com.ibatis.sqlmap.engine.mapping.parameter.InlineParameterMapParser.p
> arseInlineParameterMap(InlineParameterMapParser.java:50)
>         at  
> com.ibatis.sqlmap.engine.builder.xml.SqlStatementParser.applyInlinePa
> rameterMap(SqlStatementParser.java:377)
>         at  
> com.ibatis.sqlmap.engine.builder.xml.SqlStatementParser.processSqlSta
> tement(SqlStatementParser.java:185)
>         at  
> com.ibatis.sqlmap.engine.builder.xml.SqlStatementParser.parseGeneralS
> tatement(SqlStatementParser.java:139)
>         at com.ibatis.sqlmap.engine.builder.xml.SqlMapParser 
> $19.process(SqlMapPa
> rser.java:516)
>         at com.ibatis.common.xml.NodeletParser.processNodelet 
> (NodeletParser.java
> :112)
>         ... 28 more
>
> Caused by:
> com.ibatis.common.beans.ProbeException: There is no READABLE  
> property named 'Nam
> e' in class 'com.dwrtest.model.Employee'
>         at com.ibatis.common.beans.ClassInfo.getGetterType  
> (ClassInfo.java:188)
>         at  
> com.ibatis.common.beans.GenericProbe.getClassPropertyTypeForGetter(Ge
> nericProbe.java:226)
>         at  
> com.ibatis.common.beans.GenericProbe.getPropertyTypeForGetter(Generic
> Probe.java :155)
>         at  
> com.ibatis.sqlmap.engine.mapping.parameter.InlineParameterMapParser.r
> esolveTypeHandler(InlineParameterMapParser.java:212)
>         at  
> com.ibatis.sqlmap.engine.mapping.parameter.InlineParameterMapParser.n
> ewParseMapping(InlineParameterMapParser.java:121)
>         at  
> com.ibatis.sqlmap.engine.mapping.parameter.InlineParameterMapParser.p
> arseInlineParameterMap(InlineParameterMapParser.java:50)
>         at  
> com.ibatis.sqlmap.engine.builder.xml.SqlStatementParser.applyInlinePa
> rameterMap(SqlStatementParser.java:377)
>         at  
> com.ibatis.sqlmap.engine.builder.xml.SqlStatementParser.processSqlSta
> tement(SqlStatementParser.java:185)
>         at  
> com.ibatis.sqlmap.engine.builder.xml.SqlStatementParser.parseGeneralS
> tatement(SqlStatementParser.java:139)
>         at com.ibatis.sqlmap.engine.builder.xml.SqlMapParser 
> $19.process(SqlMapPa
> rser.java:516)
>         at com.ibatis.common.xml.NodeletParser.processNodelet 
> (NodeletParser.java
> :112)
>         at com.ibatis.common.xml.NodeletParser.process 
> (NodeletParser.java:75)
>         at com.ibatis.common.xml.NodeletParser.process 
> (NodeletParser.java:93)
>         at com.ibatis.common.xml.NodeletParser.parse  
> (NodeletParser.java:63)
>         at com.ibatis.common.xml.NodeletParser.parse 
> (NodeletParser.java:51)
>         at com.ibatis.sqlmap.engine.builder.xml.SqlMapParser.parse 
> (SqlMapParser.
> java:45)
>         at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser 
> $11.process (Sq
> lMapConfigParser.java:347)
>         at com.ibatis.common.xml.NodeletParser.processNodelet 
> (NodeletParser.java
> :112)
>         at com.ibatis.common.xml.NodeletParser.process 
> (NodeletParser.java:75)
>         at com.ibatis.common.xml.NodeletParser.process 
> (NodeletParser.java:93)
>         at com.ibatis.common.xml.NodeletParser.parse 
> (NodeletParser.java:63)
>         at com.ibatis.common.xml.NodeletParser.parse 
> (NodeletParser.java:51)
>         at  
> com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapC
> onfigParser.java:78)
>         at  
> com.ibatis.sqlmap.client.SqlMapClientBuilder.buildSqlMapClient(SqlMap
> ClientBuilder.java:62)
>         at com.dwrtest.util.SqlClient.<clinit>(SqlClient.java:16)
>         at com.dwrtest.util.EmployeeDAO.execute(EmployeeDAO.java:13)
>         at jsp_servlet._pages.__test._jspService(__test.java:131)
>         at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
>         at weblogic.servlet.internal.ServletStubImpl 
> $ServletInvocationAction.run
> (ServletStubImpl.java:1006)
>         at weblogic.servlet.internal.ServletStubImpl.invokeServlet  
> (ServletStubIm
> pl.java:419)
>         at weblogic.servlet.internal.ServletStubImpl.invokeServlet 
> (ServletStubIm
> pl.java:463)
>         at weblogic.servlet.internal.ServletStubImpl.invokeServlet 
> (ServletStubIm
> pl.java :315)
>         at weblogic.servlet.internal.WebAppServletContext 
> $ServletInvocationActio
> n.run(WebAppServletContext.java:6718)
>         at weblogic.security.acl.internal.AuthenticatedSubject.doAs 
> (Authenticate
> dSubject.java :321)
>         at weblogic.security.service.SecurityManager.runAs 
> (SecurityManager.java:
> 121)
>         at  
> weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
> rvletContext.java:3764)
>         at weblogic.servlet.internal.ServletRequestImpl.execute 
> (ServletRequestIm
> pl.java:2644)
>         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java: 
> 219)
>         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java :178)
>
> Caused by:
> com.ibatis.common.beans.ProbeException: There is no READABLE  
> property named 'Nam
> e' in class 'com.dwrtest.model.Employee'
>         at com.ibatis.common.beans.ClassInfo.getGetterType 
> (ClassInfo.java :188)
>         at  
> com.ibatis.common.beans.GenericProbe.getClassPropertyTypeForGetter(Ge
> nericProbe.java:226)
>         at  
> com.ibatis.common.beans.GenericProbe.getPropertyTypeForGetter(Generic
> Probe.java:155)
>         at  
> com.ibatis.sqlmap.engine.mapping.parameter.InlineParameterMapParser.r
> esolveTypeHandler(InlineParameterMapParser.java:212)
>         at  
> com.ibatis.sqlmap.engine.mapping.parameter.InlineParameterMapParser.n
> ewParseMapping( InlineParameterMapParser.java:121)
>         at  
> com.ibatis.sqlmap.engine.mapping.parameter.InlineParameterMapParser.p
> arseInlineParameterMap(InlineParameterMapParser.java:50)
>         at  
> com.ibatis.sqlmap.engine.builder.xml.SqlStatementParser.applyInlinePa
> rameterMap(SqlStatementParser.java:377)
>         at  
> com.ibatis.sqlmap.engine.builder.xml.SqlStatementParser.processSqlSta
> tement(SqlStatementParser.java:185)
>         at  
> com.ibatis.sqlmap.engine.builder.xml.SqlStatementParser.parseGeneralS
> tatement(SqlStatementParser.java:139)
>         at com.ibatis.sqlmap.engine.builder.xml.SqlMapParser 
> $19.process(SqlMapPa
> rser.java:516)
>         at com.ibatis.common.xml.NodeletParser.processNodelet 
> (NodeletParser.java
> :112)
>         at com.ibatis.common.xml.NodeletParser.process 
> (NodeletParser.java:75)
>         at com.ibatis.common.xml.NodeletParser.process 
> (NodeletParser.java:93)
>         at com.ibatis.common.xml.NodeletParser.parse  
> (NodeletParser.java:63)
>         at com.ibatis.common.xml.NodeletParser.parse 
> (NodeletParser.java:51)
>         at com.ibatis.sqlmap.engine.builder.xml.SqlMapParser.parse 
> (SqlMapParser.
> java:45)
>         at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser 
> $11.process (Sq
> lMapConfigParser.java:347)
>         at com.ibatis.common.xml.NodeletParser.processNodelet 
> (NodeletParser.java
> :112)
>         at com.ibatis.common.xml.NodeletParser.process 
> (NodeletParser.java:75)
>         at com.ibatis.common.xml.NodeletParser.process 
> (NodeletParser.java:93)
>         at com.ibatis.common.xml.NodeletParser.parse 
> (NodeletParser.java:63)
>         at com.ibatis.common.xml.NodeletParser.parse 
> (NodeletParser.java:51)
>         at  
> com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapC
> onfigParser.java:78)
>         at  
> com.ibatis.sqlmap.client.SqlMapClientBuilder.buildSqlMapClient(SqlMap
> ClientBuilder.java:62)
>         at com.dwrtest.util.SqlClient.<clinit>(SqlClient.java:16)
>         at com.dwrtest.util.EmployeeDAO.execute(EmployeeDAO.java:13)
>         at jsp_servlet._pages.__test._jspService(__test.java:131)
>         at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
>         at weblogic.servlet.internal.ServletStubImpl 
> $ServletInvocationAction.run
> (ServletStubImpl.java:1006)
>         at weblogic.servlet.internal.ServletStubImpl.invokeServlet  
> (ServletStubIm
> pl.java:419)
>         at weblogic.servlet.internal.ServletStubImpl.invokeServlet 
> (ServletStubIm
> pl.java:463)
>         at weblogic.servlet.internal.ServletStubImpl.invokeServlet 
> (ServletStubIm
> pl.java :315)
>         at weblogic.servlet.internal.WebAppServletContext 
> $ServletInvocationActio
> n.run(WebAppServletContext.java:6718)
>         at weblogic.security.acl.internal.AuthenticatedSubject.doAs 
> (Authenticate
> dSubject.java :321)
>         at weblogic.security.service.SecurityManager.runAs 
> (SecurityManager.java:
> 121)
>         at  
> weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
> rvletContext.java:3764)
>         at weblogic.servlet.internal.ServletRequestImpl.execute 
> (ServletRequestIm
> pl.java:2644)
>         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java: 
> 219)
>         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java :178)
> java.lang.NullPointerException
>         at com.dwrtest.util.EmployeeDAO.execute(EmployeeDAO.java:20)
>         at jsp_servlet._pages.__test._jspService(__test.java:131)
>         at weblogic.servlet.jsp.JspBase.service (JspBase.java:33)
>         at weblogic.servlet.internal.ServletStubImpl 
> $ServletInvocationAction.run
> (ServletStubImpl.java:1006)
>         at weblogic.servlet.internal.ServletStubImpl.invokeServlet 
> (ServletStubIm
> pl.java :419)
>         at weblogic.servlet.internal.ServletStubImpl.invokeServlet 
> (ServletStubIm
> pl.java:463)
>         at weblogic.servlet.internal.ServletStubImpl.invokeServlet 
> (ServletStubIm
> pl.java:315)
>         at weblogic.servlet.internal.WebAppServletContext 
> $ServletInvocationActio
> n.run(WebAppServletContext.java:6718)
>         at weblogic.security.acl.internal.AuthenticatedSubject.doAs 
> (Authenticate
> dSubject.java:321)
>         at weblogic.security.service.SecurityManager.runAs 
> (SecurityManager.java :
> 121)
>         at  
> weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
> rvletContext.java:3764)
>         at weblogic.servlet.internal.ServletRequestImpl.execute 
> (ServletRequestIm
> pl.java:2644)
>         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java: 
> 219)
>         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
>
> -- 
> Akhil Kodali
> <Employee.java>
> <EmployeeDAO.java>
> <SqlClient.java>
> <SqlMapConfig.xml>
> <SqlMapTest.xml>


Mime
View raw message