A Throwable occurred while trying to reset the typeMap property of our Connection to Collections.EMPTY_MAP!
java.sql.SQLException: The Connection.setTypeMap(Map) method is not implemented.
java.sql.SQLException: The Connection.setTypeMap(Map) method is not implemented.
解决方案 »
- Struts2 如何动态载Action
- 调用外部的webservice,报错!!(500)Internal Server Error
- 请教一个hibernate数据库事务的问题
- 请问怎么做能够实现一般博客那样在字符中间显示图片?
- Tomcat 5.0.x 中的JSP页面是不是必须放在 xxxxx\ROOT\下呀,能不能去掉ROOT
- struts中,我一张表单提交上去,在action里插入到数据库表里,在mapping.findForward转到一张页面...在张等
- struts中每一个form对应的javabean是不是都要创建一个controller啊?
- java&xml
- 【醒目】获取数据库数据输出json出错,求大神帮忙看看
- Springboot启动内存溢出
- 怎样用java代码将xml文件内容写入txt文件中
- spring 中 aop 日志问题
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<!-- 定义c3p0数据源 -->
<bean id = "database"
class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">
<!-- 指定数据库连接驱动 -->
<property name= "driverClass" value="net.sourceforge.jtds.jdbc.Driver"/>
<!-- 指定连接数据库 -->
<property name="jdbcUrl" value = "jdbc:jtds:sqlserver://127.0.0.1:1433/Mtr" />
<!-- 指定数据库的连接用户名-->
<property name="user" value ="sa" />
<property name="password" value ="sa" />
<!-- 指定连接数据库连接池的最大连接数 -->
<property name="maxPoolSize" value="60"/>
<!-- 指定连接数据库连接池的最小连接数 -->
<property name="minPoolSize" value="20"/>
<!-- 指定连接数据库连接池的初始化连接数 -->
<property name="initialPoolSize" value="20"/>
<!-- 指定连接数据库连接池的连接的最大空闲时间 -->
<property name="maxIdleTime" value="20"/>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="database" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>ksec/lql/dao/Employee.hbm.xml</value>
</list>
</property>
</bean>
<bean id="mathBean" class="ksec.lql.service.employeeModSerImpl" />
<bean id="SpringContextUtil " class="ksec.lql.db.SpringContextUtil" lazy-init="false"/>
<!--装配实现类-->
<bean id="EmployeeDAO" class="ksec.lql.dao.EmployeeDAO">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
</beans>
* Employee generated by MyEclipse Persistence Tools
*/public class Employee implements java.io.Serializable { // Fields private String empId; private String empName; private String sex; private String loginName; private String passWord; // Constructors /** default constructor */
public Employee() {
} /** minimal constructor */
public Employee(String empId, String empName, String loginName) {
this.empId = empId;
this.empName = empName;
this.loginName = loginName;
} /** full constructor */
public Employee(String empId, String empName, String sex, String loginName,
String passWord) {
this.empId = empId;
this.empName = empName;
this.sex = sex;
this.loginName = loginName;
this.passWord = passWord;
} // Property accessors public String getEmpId() {
return this.empId;
} public void setEmpId(String empId) {
this.empId = empId;
} public String getEmpName() {
return this.empName;
} public void setEmpName(String empName) {
this.empName = empName;
} public String getSex() {
return this.sex;
} public void setSex(String sex) {
this.sex = sex;
} public String getLoginName() {
return this.loginName;
} public void setLoginName(String loginName) {
this.loginName = loginName;
} public String getPassWord() {
return this.passWord;
} public void setPassWord(String passWord) {
this.passWord = passWord;
}}
package ksec.lql.dao;import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.LockMode;
import org.springframework.context.ApplicationContext;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;/**
* Data access object (DAO) for domain model class Employee.
*
* @see ksec.lql.dao.Employee
* @author MyEclipse Persistence Tools
*/public class EmployeeDAO extends HibernateDaoSupport {
private static final Log log = LogFactory.getLog(EmployeeDAO.class); // property constants
public static final String EMP_NAME = "empName"; public static final String SEX = "sex"; public static final String LOGIN_NAME = "loginName"; public static final String PASS_WORD = "passWord"; protected void initDao() {
// do nothing
} public void save(Employee transientInstance) {
log.debug("saving Employee instance");
try {
getHibernateTemplate().save(transientInstance);
log.debug("save successful");
} catch (RuntimeException re) {
log.error("save failed", re);
throw re;
}
} public void delete(Employee persistentInstance) {
log.debug("deleting Employee instance");
try {
getHibernateTemplate().delete(persistentInstance);
log.debug("delete successful");
} catch (RuntimeException re) {
log.error("delete failed", re);
throw re;
}
} public Employee findById(java.lang.String id) {
log.debug("getting Employee instance with id: " + id);
try {
Employee instance = (Employee) getHibernateTemplate().get(
"ksec.lql.dao.Employee", id);
return instance;
} catch (RuntimeException re) {
log.error("get failed", re);
throw re;
}
} public List findByExample(Employee instance) {
log.debug("finding Employee instance by example");
try {
List results = getHibernateTemplate().findByExample(instance);
log.debug("find by example successful, result size: "
+ results.size());
return results;
} catch (RuntimeException re) {
log.error("find by example failed", re);
throw re;
}
} public List findByProperty(String propertyName, Object value) {
log.debug("finding Employee instance with property: " + propertyName
+ ", value: " + value);
try {
String queryString = "from Employee as model where model."
+ propertyName + "= ?";
return getHibernateTemplate().find(queryString, value);
} catch (RuntimeException re) {
log.error("find by property name failed", re);
throw re;
}
} public List findByEmpName(Object empName) {
return findByProperty(EMP_NAME, empName);
} public List findBySex(Object sex) {
return findByProperty(SEX, sex);
} public List findByLoginName(Object loginName) {
return findByProperty(LOGIN_NAME, loginName);
} public List findByPassWord(Object passWord) {
return findByProperty(PASS_WORD, passWord);
} public List findAll() {
log.debug("finding all Employee instances");
try {
String queryString = "from Employee";
return getHibernateTemplate().find(queryString);
} catch (RuntimeException re) {
log.error("find all failed", re);
throw re;
}
} public Employee merge(Employee detachedInstance) {
log.debug("merging Employee instance");
try {
Employee result = (Employee) getHibernateTemplate().merge(
detachedInstance);
log.debug("merge successful");
return result;
} catch (RuntimeException re) {
log.error("merge failed", re);
throw re;
}
} public void attachDirty(Employee instance) {
log.debug("attaching dirty Employee instance");
try {
getHibernateTemplate().saveOrUpdate(instance);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
} public void attachClean(Employee instance) {
log.debug("attaching clean Employee instance");
try {
getHibernateTemplate().lock(instance, LockMode.NONE);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
} public static EmployeeDAO getFromApplicationContext(ApplicationContext ctx) {
return (EmployeeDAO) ctx.getBean("EmployeeDAO");
}
}