use mybatis insert sentence to: There is no getter for property named "DictionaryType" in" class com.bjpowernode.crm.domain.DictionaryType"
the code is as follows:
public int insertDictionaryType(DictionaryType dictionaryType) {
SqlSessionFactory sqlSessionFactory = null;
SqlSession sqlSession = null;
int num = 0;
try {
sqlSessionFactory = new SqlSessionFactoryBuilder()
.build(Resources.getResourceAsStream("mybatis-config.xml"));
sqlSession = sqlSessionFactory.openSession();
dictionaryType.setCode(UUIDGenerator.generate());
num = sqlSession.insert("insertDictionaryType", dictionaryType);
sqlSession.commit();
} catch (IOException e) {
if (sqlSession != null) {
sqlSession.rollback();
}
} finally {
if (sqlSession != null) {
sqlSession.close();
}
}
return num;
}
mapper.xml is configured as follows:
<mapper namespace="com.bjpowernode.crm.domain">
<insert id="insertDictionaryType" parameterType="DictionaryType">
insert into
tbl_dic_type
values
(-sharp{DictionaryType.code},-sharp{DictionaryType.name},-sharp{DictionaryType.description})
</insert>
</mapper>
DictionaryType class information is as follows:
public class DictionaryType {
private String code;
private String name;
private String description;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}