package com.example;com/example/SavedUserSessionMapper.xml
public interface SavedUserSessionMapper {
public SavedUserSession getSessionByIdentifier(String identifier);
}
<?xml version="1.0" encoding="UTF-8" ?>database.xml
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xmlnamespace.panel.server.core.authentication.SavedUserSessionMapper">
<select id="getSessionByIdentifier" parameterType="String">
SELECT
id,
session_id AS sessionIdentifier,
user_id as userIdentifier
FROM user_sessions
WEHRE session_id=#{value}
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<environments default="development">
<environment id="development">
<transactionManager type="JDBC"/>
<dataSource type="POOLED">
<property name="driver" value="org.h2.Driver"/>
<property name="url" value="hdbc:h2:file:database"/>
<property name="username" value="admin"/>
<property name="password" value="admin"/>
</dataSource>
</environment>
</environments>
</configuration>
// Instance variablesThen, later on in the code, I call the addMapper method of the above class:
private Configuration configuration = null;
private SqlSessionFactory factory = null;
// ... initialize method...
InputStream is = null;
try {
is = new FileInputStream("/path/to/database.xml");
final XMLConfigBuilder builder = new XMLConfigBuilder(is);
configuration = builder.parse();
factory = new SqlSessionFactoryBuilder().build(configuration);
} catch (final IOException e) {
// Error handling
}
// And a method to register a new mapper
public <T> void addMapper(Class<T> type) {
configuration.addMapper(type);
}
database.addMapper(SavedUserSessionMapper.class);And it throws this exception:
I first had a resultType="com.example.SavedUserSession" in that select tag, because I thought that was the correct syntax. However, the problem still happens when it has that, like this:you missing result...
you declare configuration xml file that typeAlias. and declare mapper xml file resultClass or resultMapmapper xml file is not exist result that <select /> element...
Please send relation files.
I tried sample coding.
2013. 1. 3. 오전 11:08에 "Colin Williams" <col...@i9technologies.com>님이 작성:
You are welcome. It is my pleaser. Me too thank you your question.
2013. 1. 5. 오전 5:45에 "Colin Williams" <col...@i9technologies.com>님이 작성: