iBatis 关系的配置,!

相关文章:
『出错』MS SQL 2000 :驱动不支持指定的SQL类型
求助动态Mapped Statement
springframe 2.5中jpetStore的例子

推荐圈子: JBPM @net
更多相关推荐 程序所涉及的lib版本分别为:
ibatis-common-2.2.0.638.jar
ibatis-dao-2.2.0.638.jar
ibatis-sqlmap-2.2.0.638.jar
spring-1.2.8.jar
junit-3.8.1.jar

程序所涉及的源文件分别为:
// ******************************* iBatis *******************
# classpath:/ibatis/sql-map-config.xml
Java代码
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMapConfig PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN" "http://www.ibatis.com/dtd/sql-map-config-2.dtd">
<sqlMapConfig>
<settings
cacheModelsEnabled ="true"

<!-- 此处为false程序运行正常,但无法延迟,,若此处修改为 true 时,junit test会出现错误,具体错误见文章末尾 -->
enhancementEnabled ="false" // <SPAN style="COLOR: red">****</SPAN>
lazyLoadingEnabled ="true"
errorTracingEnabled ="true"
maxRequests ="32"
maxSessions ="10"
maxTransactions ="5"
useStatementNamespaces ="true"
/>

<sqlMap resource="ibatis/maps/Parent.xml"/>
<sqlMap resource="ibatis/maps/Child.xml"/>
</sqlMapConfig>

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMapConfig PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN" "http://www.ibatis.com/dtd/sql-map-config-2.dtd">
<sqlMapConfig>
<settings
cacheModelsEnabled ="true"

<!-- 此处为false程序运行正常,但无法延迟,,若此处修改为 true 时,junit test会出现错误,具体错误见文章末尾 -->
enhancementEnabled ="false" // ****
lazyLoadingEnabled ="true"
errorTracingEnabled ="true"
maxRequests ="32"
maxSessions ="10"
maxTransactions ="5"
useStatementNamespaces ="true"
/>

<sqlMap resource="ibatis/maps/Parent.xml"/>
<sqlMap resource="ibatis/maps/Child.xml"/>
</sqlMapConfig>

# classpath:/ibatis/maps/Parent.xml
Java代码
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="Parent">
<resultMap id="result" class="com.domain.Parent">
<result property="id" column="ID"/>
<result property="name" column="PARENT_NAME"/>
</resultMap>

<resultMap id="resultAll" class="com.domain.Parent" extends="result">
<!-- java.util.List children; -->
<result property="children" column="ID" select="Child.findByParent"/>
</resultMap>

<statement id="save">
<selectKey resultClass="java.lang.Long" keyProperty="id">
SELECT SEQ_PARENT_ID.NEXTVAL AS id FROM DUAL
</selectKey>

INSERT INTO PARENT
(ID, PARENT_NAME)
values
(#id#, #PARENT_NAME:VARCHAR#)
</statement>

<statement id="update">
update PARENT t
set t.PARENT_NAME = #PARENT_NAME:VARCHAR#
where t.ID = #id#
</statement>

<statement id="delete">
delete from PARENT t
where t.ID = #id#
</statement>

<statement id="get" parameterClass="java.lang.Long" resultMap="result">
select *
from PARENT t
where t.ID = #id#
</statement>
</sqlMap>

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="Parent">
<resultMap id="result" class="com.domain.Parent">
<result property="id" column="ID"/>
<result property="name" column="PARENT_NAME"/>
</resultMap>

<resultMap id="resultAll" class="com.domain.Parent" extends="result">
<!-- java.util.List children; -->
<result property="children" column="ID" select="Child.findByParent"/>
</resultMap>

<statement id="save">
<selectKey resultClass="java.lang.Long" keyProperty="id">
SELECT SEQ_PARENT_ID.NEXTVAL AS id FROM DUAL
</selectKey>

INSERT INTO PARENT
(ID, PARENT_NAME)
values
(#id#, #PARENT_NAME:VARCHAR#)
</statement>

<statement id="update">
update PARENT t
set t.PARENT_NAME = #PARENT_NAME:VARCHAR#
where t.ID = #id#
</statement>

<statement id="delete">
delete from PARENT t
where t.ID = #id#
</statement>

<statement id="get" parameterClass="java.lang.Long" resultMap="result">
select *
from PARENT t
where t.ID = #id#
</statement>
</sqlMap>

# com.domain.base.BaseParent.java
Java代码
package com.domain.base;

import java.io.Serializable;
import java.util.List;
/**
* This is an object that contains data related to the PARENT table. Do
* not modify this class because it will be overwritten if the configuration
* file related to this class is modified.
*
* table="PARENT"
*
* @author Lincee
*/
public abstract class BaseParent implements Serializable {
public BaseParent(){}
public BaseParent(Long id){this.setId(id);}
private int hashCode = Integer.MIN_VALUE;
private Long id;
private String name;
private List children;
// setter, getter;
public boolean equals(Object obj) { ... }
public int hashCode() { ... }
}

package com.domain.base;

import java.io.Serializable;
import java.util.List;
/**
* This is an object that contains data related to the PARENT table. Do
* not modify this class because it will be overwritten if the configuration
* file related to this class is modified.
*
* table="PARENT"
*
* @author Lincee
*/
public abstract class BaseParent implements Serializable {
public BaseParent(){}
public BaseParent(Long id){this.setId(id);}
private int hashCode = Integer.MIN_VALUE;
private Long id;
private String name;
private List children;
// setter, getter;
public boolean equals(Object obj) { ... }
public int hashCode() { ... }
}

# com.domain.Parent.java
Java代码
package com.domain;
import com.domain.base.BaseParent;
public class Parent extends BaseParent {
private static final long serialVersionUID = 1L;

public Parent(){super();}
public Parent(Long id){super(id);}
}

package com.domain;
import com.domain.base.BaseParent;
public class Parent extends BaseParent {
private static final long serialVersionUID = 1L;

public Parent(){super();}
public Parent(Long id){super(id);}
}

# classpath:/ibatis/maps/Child.xml
Java代码
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="Child">
<resultMap id="result" class="com.domain.Child">
<result property="id" column="ID"/>
<result property="name" column="CHILD_NAME"/>
<result property="parentId" column="PARENT_ID"/>
<result property="parent" column="PARENT_ID" select="Parent.get"/>
</resultMap>

<statement id="save">
<selectKey resultClass="java.lang.Long" keyProperty="id">
SELECT SEQ_CHILD_ID.NEXTVAL AS id FROM DUAL
</selectKey>

INSERT INTO CHILD
(ID, CHILD_NAME)
values
(#id#, #CHILD_NAME:VARCHAR#)
</statement>

<statement id="update">
update CHILD t
set t.CHILD_NAME = #CHILD_NAME:VARCHAR#
where t.ID = #id#
</statement>

<statement id="delete">
delete from CHILD t
where t.ID = #id#
</statement>

<statement id="get" parameterClass="java.lang.Long" resultMap="result">
select *
from CHILD t
where t.ID = #id#
</statement>
</sqlMap>

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="Child">
<resultMap id="result" class="com.domain.Child">
<result property="id" column="ID"/>
<result property="name" column="CHILD_NAME"/>
<result property="parentId" column="PARENT_ID"/>
<result property="parent" column="PARENT_ID" select="Parent.get"/>
</resultMap>

<statement id="save">
<selectKey resultClass="java.lang.Long" keyProperty="id">
SELECT SEQ_CHILD_ID.NEXTVAL AS id FROM DUAL
</selectKey>

INSERT INTO CHILD
(ID, CHILD_NAME)
values
(#id#, #CHILD_NAME:VARCHAR#)
</statement>

<statement id="update">
update CHILD t
set t.CHILD_NAME = #CHILD_NAME:VARCHAR#
where t.ID = #id#
</statement>

<statement id="delete">
delete from CHILD t
where t.ID = #id#
</statement>

<statement id="get" parameterClass="java.lang.Long" resultMap="result">
select *
from CHILD t
where t.ID = #id#
</statement>
</sqlMap>

# com.domain.base.BaseChild.java
Java代码
package com.domain.base;
import java.io.Serializable;
import com.domain.Parent;
/**
* This is an object that contains data related to the CHILD table. Do
* not modify this class because it will be overwritten if the configuration
* file related to this class is modified.
*
* table="CHILD"
*
* @author Lincee
*/
public abstract class BaseChild implements Serializable {
public BaseChild(){}
public BaseChild(Long id){this.setId(id);}
private int hashCode = Integer.MIN_VALUE;
private Long id;
private String name;
private Parent parent;
// setter, getter;
public boolean equals(Object obj) { ... }
public int hashCode() { ... }
}

package com.domain.base;
import java.io.Serializable;
import com.domain.Parent;
/**
* This is an object that contains data related to the CHILD table. Do
* not modify this class because it will be overwritten if the configuration
* file related to this class is modified.
*
* table="CHILD"
*
* @author Lincee
*/
public abstract class BaseChild implements Serializable {
public BaseChild(){}
public BaseChild(Long id){this.setId(id);}
private int hashCode = Integer.MIN_VALUE;
private Long id;
private String name;
private Parent parent;
// setter, getter;
public boolean equals(Object obj) { ... }
public int hashCode() { ... }
}

# com.domain.Child.java
Java代码
package com.domain;
import com.domain.base.BaseChild;
public class Child extends BaseChild {
private static final long serialVersionUID = 1L;

public Child(){super();}
public Child(Long id){super(id);}
}

package com.domain;
import com.domain.base.BaseChild;
public class Child extends BaseChild {
private static final long serialVersionUID = 1L;

public Child(){super();}
public Child(Long id){super(id);}
}

// ******************************* Spring *******************
Java代码
<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
<property name="configLocation" value="classpath:/ibatis/sql-map-config.xml"/>
<property name="dataSource" ref="dataSource"/>
</bean>

<bean id="baseDao" abstract="true" class="com.dao.BaseDaoImpl">
<property name="sqlMapClient" ref="sqlMapClient"/>
</bean>

<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
<property name="configLocation" value="classpath:/ibatis/sql-map-config.xml"/>
<property name="dataSource" ref="dataSource"/>
</bean>

<bean id="baseDao" abstract="true" class="com.dao.BaseDaoImpl">
<property name="sqlMapClient" ref="sqlMapClient"/>
</bean>

// ******************************* JUnit ********************
# com.framework.test.TestBase
Java代码
package com.framework.test;
import junit.framework.TestCase;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
*
*
* @author Lincee
*/
public abstract class TestBase extends TestCase {
protected String getSpringContextPath() {
return "spring/*.xml";
}
protected ApplicationContext applicationContext = null;
protected final void setUp() throws Exception {
super.setUp();
applicationContext = new ClassPathXmlApplicationContext(
getSpringContextPath());
initialize();
}
protected abstract void initialize() throws Exception;
public abstract void testDao() throws Exception;
}

package com.framework.test;
import junit.framework.TestCase;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
*
*
* @author Lincee
*/
public abstract class TestBase extends TestCase {
protected String getSpringContextPath() {
return "spring/*.xml";
}
protected ApplicationContext applicationContext = null;
protected final void setUp() throws Exception {
super.setUp();
applicationContext = new ClassPathXmlApplicationContext(
getSpringContextPath());
initialize();
}
protected abstract void initialize() throws Exception;
public abstract void testDao() throws Exception;
}

# com.dao.TestChildDao
Java代码
package com.dao;
import junit.framework.Assert;
public class TestChildDao extends TestBase {
private ChildDao childDao;
protected void initialize() throws Exception {
childDao = (ChildDao) applicationContext.getBean("childDao");
}

public void testDao() throws Exception {
Assert.assertNotNull(childDao);
}

public void testGet() {
Child child = childDao.get(1L);
System.out.println(child.getName());
// System.out.println(child.getName() + " : " + child.getParent().getName());
}
}

package com.dao;
import junit.framework.Assert;
public class TestChildDao extends TestBase {
private ChildDao childDao;
protected void initialize() throws Exception {
childDao = (ChildDao) applicationContext.getBean("childDao");
}

public void testDao() throws Exception {
Assert.assertNotNull(childDao);
}

public void testGet() {
Child child = childDao.get(1L);
System.out.println(child.getName());
// System.out.println(child.getName() + " : " + child.getParent().getName());
}
}

// ********** enhancementEnabled = "true" 运行的错误信息 ******
Java代码
org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [null]; error code [0];
--- The error occurred in ibatis/maps/Child.xml.
--- The error occurred while applying a result map.
--- Check the Child.resultAll.
--- Check the result mapping for the 'parent' property.
--- Cause: net.sf.cglib.core.CodeGenerationException: net.sf.cglib.proxy.UndeclaredThrowableException-->java.lang.IllegalAccessException-->Class com.ibatis.sqlmap.engine.mapping.result.loader.EnhancedLazyResultLoader$EnhancedLazyResultLoaderImpl can not access a member of class com.domain.base.BaseParent with modifiers "protected"; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in ibatis/maps/Child.xml.
--- The error occurred while applying a result map.
--- Check the Child.result.
--- Check the result mapping for the 'parent' property.
--- Cause: net.sf.cglib.core.CodeGenerationException: net.sf.cglib.proxy.UndeclaredThrowableException-->java.lang.IllegalAccessException-->Class com.ibatis.sqlmap.engine.mapping.result.loader.EnhancedLazyResultLoader$EnhancedLazyResultLoaderImpl can not access a member of class com.domain.base.BaseParent with modifiers "protected"
Caused by: net.sf.cglib.core.CodeGenerationException: net.sf.cglib.proxy.UndeclaredThrowableException-->java.lang.IllegalAccessException-->Class com.ibatis.sqlmap.engine.mapping.result.loader.EnhancedLazyResultLoader$EnhancedLazyResultLoaderImpl can not access a member of class com.domain.base.BaseParent with modifiers "protected"
com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in ibatis/maps/Child.xml.
--- The error occurred while applying a result map.
--- Check the Child.result.
--- Check the result mapping for the 'parent' property.
--- Cause: net.sf.cglib.core.CodeGenerationException: net.sf.cglib.proxy.UndeclaredThrowableException-->java.lang.IllegalAccessException-->Class com.ibatis.sqlmap.engine.mapping.result.loader.EnhancedLazyResultLoader$EnhancedLazyResultLoaderImpl can not access a member of class com.domain.base.BaseParent with modifiers "protected"
Caused by: net.sf.cglib.core.CodeGenerationException: net.sf.cglib.proxy.UndeclaredThrowableException-->java.lang.IllegalAccessException-->Class com.ibatis.sqlmap.engine.mapping.result.loader.EnhancedLazyResultLoader$EnhancedLazyResultLoaderImpl can not access a member of class com.domain.base.BaseParent with modifiers "protected"
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:188)
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForObject(GeneralStatement.java:104)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:565)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:540)
at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject(SqlMapSessionImpl.java:106)
at org.springframework.orm.ibatis.SqlMapClientTemplate$1.doInSqlMapClient(SqlMapClientTemplate.java:210)
at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:168)
at org.springframework.orm.ibatis.SqlMapClientTemplate.queryForObject(SqlMapClientTemplate.java:208)
at com.framework.dao.impl.BaseDaoImpl.get(BaseDaoImpl.java:78)
at com.dao.TestChildDao.testGet(TestChildDao.java:96)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: net.sf.cglib.core.CodeGenerationException: net.sf.cglib.proxy.UndeclaredThrowableException-->java.lang.IllegalAccessException-->Class com.ibatis.sqlmap.engine.mapping.result.loader.EnhancedLazyResultLoader$EnhancedLazyResultLoaderImpl can not access a member of class com.domain.base.BaseParent with modifiers "protected"
at net.sf.cglib.core.ReflectUtils.newInstance(ReflectUtils.java:235)
at net.sf.cglib.core.ReflectUtils.newInstance(ReflectUtils.java:220)
at net.sf.cglib.core.ReflectUtils.newInstance(ReflectUtils.java:216)
at net.sf.cglib.proxy.Enhancer.createUsingReflection(Enhancer.java:566)
at net.sf.cglib.proxy.Enhancer.firstInstance(Enhancer.java:493)
at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:220)
at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:368)
at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:280)
at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:581)
at com.ibatis.sqlmap.engine.mapping.result.loader.EnhancedLazyResultLoader$EnhancedLazyResultLoaderImpl.loadResult(EnhancedLazyResultLoader.java:104)
at com.ibatis.sqlmap.engine.mapping.result.loader.EnhancedLazyResultLoader.loadResult(EnhancedLazyResultLoader.java:59)
at com.ibatis.sqlmap.engine.mapping.result.loader.ResultLoader.loadResult(ResultLoader.java:53)
at com.ibatis.sqlmap.engine.mapping.result.BasicResultMap.getNestedSelectMappingValue(BasicResultMap.java:504)
at com.ibatis.sqlmap.engine.mapping.result.BasicResultMap.getResults(BasicResultMap.java:340)
at com.ibatis.sqlmap.engine.execution.SqlExecutor.handleResults(SqlExecutor.java:375)
at com.ibatis.sqlmap.engine.execution.SqlExecutor.handleMultipleResults(SqlExecutor.java:295)
at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(SqlExecutor.java:186)
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.sqlExecuteQuery(GeneralStatement.java:205)
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:173)
... 22 more
Caused by: net.sf.cglib.proxy.UndeclaredThrowableException: java.lang.IllegalAccessException-->Class com.ibatis.sqlmap.engine.mapping.result.loader.EnhancedLazyResultLoader$EnhancedLazyResultLoaderImpl can not access a member of class com.domain.base.BaseParent with modifiers "protected"
at com.domain.Parent$$EnhancerByCGLIB$$e337ec8b.initialize(<generated>)
at com.domain.base.BaseParent.<init>(BaseParent.java:22)
at com.domain.Parent.<init>(Parent.java:18)
at com.domain.Parent$$EnhancerByCGLIB$$e337ec8b.<init>(<generated>)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at net.sf.cglib.core.ReflectUtils.newInstance(ReflectUtils.java:228)
... 40 more
Caused by: java.lang.IllegalAccessException: Class com.ibatis.sqlmap.engine.mapping.result.loader.EnhancedLazyResultLoader$EnhancedLazyResultLoaderImpl can not access a member of class com.domain.base.BaseParent with modifiers "protected"
at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:57)
at java.lang.reflect.Method.invoke(Method.java:317)
at com.ibatis.sqlmap.engine.mapping.result.loader.EnhancedLazyResultLoader$EnhancedLazyResultLoaderImpl.invoke(EnhancedLazyResultLoader.java:116)
... 49 more

Caused by:
net.sf.cglib.core.CodeGenerationException: net.sf.cglib.proxy.UndeclaredThrowableException-->java.lang.IllegalAccessException-->Class com.ibatis.sqlmap.engine.mapping.result.loader.EnhancedLazyResultLoader$EnhancedLazyResultLoaderImpl can not access a member of class com.domain.base.BaseParent with modifiers "protected"
at net.sf.cglib.core.ReflectUtils.newInstance(ReflectUtils.java:235)
at net.sf.cglib.core.ReflectUtils.newInstance(ReflectUtils.java:220)
at net.sf.cglib.core.ReflectUtils.newInstance(ReflectUtils.java:216)
at net.sf.cglib.proxy.Enhancer.createUsingReflection(Enhancer.java:566)
at net.sf.cglib.proxy.Enhancer.firstInstance(Enhancer.java:493)
at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:220)
at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:368)
at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:280)
at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:581)
at com.ibatis.sqlmap.engine.mapping.result.loader.EnhancedLazyResultLoader$EnhancedLazyResultLoaderImpl.loadResult(EnhancedLazyResultLoader.java:104)
at com.ibatis.sqlmap.engine.mapping.result.loader.EnhancedLazyResultLoader.loadResult(EnhancedLazyResultLoader.java:59)
at com.ibatis.sqlmap.engine.mapping.result.loader.ResultLoader.loadResult(ResultLoader.java:53)
at com.ibatis.sqlmap.engine.mapping.result.BasicResultMap.getNestedSelectMappingValue(BasicResultMap.java:504)
at com.ibatis.sqlmap.engine.mapping.result.BasicResultMap.getResults(BasicResultMap.java:340)
at com.ibatis.sqlmap.engine.execution.SqlExecutor.handleResults(SqlExecutor.java:375)
at com.ibatis.sqlmap.engine.execution.SqlExecutor.handleMultipleResults(SqlExecutor.java:295)
at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(SqlExecutor.java:186)
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.sqlExecuteQuery(GeneralStatement.java:205)
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:173)
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForObject(GeneralStatement.java:104)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:565)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:540)
at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject(SqlMapSessionImpl.java:106)
at org.springframework.orm.ibatis.SqlMapClientTemplate$1.doInSqlMapClient(SqlMapClientTemplate.java:210)
at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:168)
at org.springframework.orm.ibatis.SqlMapClientTemplate.queryForObject(SqlMapClientTemplate.java:208)
at com.framework.dao.impl.BaseDaoImpl.get(BaseDaoImpl.java:78)
at com.dao.TestChildDao.testGet(TestChildDao.java:96)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: net.sf.cglib.proxy.UndeclaredThrowableException: java.lang.IllegalAccessException-->Class com.ibatis.sqlmap.engine.mapping.result.loader.EnhancedLazyResultLoader$EnhancedLazyResultLoaderImpl can not access a member of class com.domain.base.BaseParent with modifiers "protected"
at com.domain.Parent$$EnhancerByCGLIB$$e337ec8b.initialize(<generated>)
at com.domain.base.BaseParent.<init>(BaseParent.java:22)
at com.domain.Parent.<init>(Parent.java:18)
at com.domain.Parent$$EnhancerByCGLIB$$e337ec8b.<init>(<generated>)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at net.sf.cglib.core.ReflectUtils.newInstance(ReflectUtils.java:228)
... 40 more
Caused by: java.lang.IllegalAccessException: Class com.ibatis.sqlmap.engine.mapping.result.loader.EnhancedLazyResultLoader$EnhancedLazyResultLoaderImpl can not access a member of class com.domain.base.BaseParent with modifiers "protected"
at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:57)
at java.lang.reflect.Method.invoke(Method.java:317)
at com.ibatis.sqlmap.engine.mapping.result.loader.EnhancedLazyResultLoader$EnhancedLazyResultLoaderImpl.invoke(EnhancedLazyResultLoader.java:116)
... 49 more
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值