MY Application context<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/b ... ns-4.2.xsd">
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver"></property>
<property name="url" value="jdbc:mysql://localhost:3306/cmsdb"></property>
<property name="username" value="root"></property>
<property name="password" value="root"></property>
</bean>
<!--<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="java:comp/env/jdbc/MyLocalDB"/>
</bean>-->
<bean id="mysessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"></property>
<property name="mappingResources">
<list>
<value>/hibernate-mapping/Department.hbm.xml</value>
<value>/hibernate-mapping/Logindtl.hbm.xml</value>
<value>/hibernate-mapping/Userdtl.hbm.xml</value>
<value>/hibernate-mapping/Userrole.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<prop key="hibernate.hbm2ddl.auto">validate</prop>
<!-- <prop key="hibernate.hbm2ddl.auto">create</prop> -->
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
</bean>
<!-- <bean id="template" class="org.springframework.orm.hibernate5.HibernateTemplate">
<property name="sessionFactory" ref="mysessionFactory"></property>
</bean> -->
<bean id="departmentbean" class="com.cms.dao.daoimpl.DepartmentDaoImpl">
<property name="sessionFactory" ref="mysessionFactory"></property>
</bean>
<bean id="logindtlbean" class="com.cms.dao.daoimpl.LogindtlDaoImpl">
<property name="sessionFactory" ref="mysessionFactory"></property>
</bean>
<bean id="userdtlbean" class="com.cms.dao.daoimpl.UserdtlDaoImpl">
<property name="sessionFactory" ref="mysessionFactory"></property>
</bean>
<bean id="userrolebean" class="com.cms.dao.daoimpl.UserroleDaoImpl">
<property name="sessionFactory" ref="mysessionFactory"></property>
</bean>
</beans>
----------------------------------------------------------------------------------------------------------------------------------
My DAOIMPL classpublic class LogindtlDaoImpl implements IfcLoginDtlDao {
private static final Log log = LogFactory.getLog(LogindtlDaoImpl.class);
private static SessionFactory sessionFactory;
public void setSessionFactory(SessionFactory sessionFactory) {
this.sessionFactory = sessionFactory;
}
public Logindtl findById(String id) {
log.debug("getting Logindtl instance with id: " + id);
try {
Session session = sessionFactory.openSession();
Transaction tx = session.beginTransaction();
Logindtl instance = (Logindtl) session.get("Logindtl", id);
tx.commit();
session.close();
// Logindtl instance = (Logindtl) sessionFactory.getCurrentSession()
// .get("Logindtl", id);
if (instance == null) {
log.debug("get successful, no instance found");
} else {
log.debug("get successful, instance found");
}
return instance;
} catch (RuntimeException re) {
log.error("get failed", re);
throw re;
}
}
}
----------------------------------------------------------------------------------
domain classpublic class Logindtl implements Serializable {
private String userid;
private String password;
private Set userdtls = new HashSet(0);
public Logindtl() {
}
public Logindtl(String userid, String password) {
this.userid = userid;
this.password = password;
}
public Logindtl(String userid, String password, Set userdtls) {
this.userid = userid;
this.password = password;
this.userdtls = userdtls;
}
public String getUserid() {
return this.userid;
}
public void setUserid(String userid) {
this.userid = userid;
}
public String getPassword() {
return this.password;
}
public void setPassword(String password) {
this.password = password;
}
public Set getUserdtls() {
return this.userdtls;
}
public void setUserdtls(Set userdtls) {
this.userdtls = userdtls;
}
}
---------------------------------------------------------------------------------------
HBM file<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated Dec 11, 2015 12:15:06 AM by Hibernate Tools 3.4.0.CR1 -->
<hibernate-mapping>
<class name="com.cms.domain.Logindtl" table="logindtl" catalog="cmsdb">
<id name="userid" type="string">
<column name="USERID" length="7" />
<generator class="assigned" />
</id>
<property name="password" type="string">
<column name="PASSWORD" length="45" not-null="true" />
</property>
<set name="userdtls" table="userdtl" inverse="true" lazy="true" fetch="select">
<key>
<column name="USERID" length="7" not-null="true" />
</key>
<one-to-many class="com.cms.domain.Userdtl" />
</set>
</class>
</hibernate-mapping>
------------------------------------------------------------------------------------------------------------------
Exceptionorg.hibernate.UnknownEntityTypeException: Unable to locate persister: Logindtl
at org.hibernate.internal.SessionFactoryImpl.locateEntityPersister(SessionFactoryImpl.java:802)
at org.hibernate.internal.SessionImpl.locateEntityPersister(SessionImpl.java:2714)
at org.hibernate.internal.SessionImpl.access$2400(SessionImpl.java:164)
at org.hibernate.internal.SessionImpl$IdentifierLoadAccessImpl.<init>(SessionImpl.java:2644)
at org.hibernate.internal.SessionImpl$IdentifierLoadAccessImpl.<init>(SessionImpl.java:2635)
at org.hibernate.internal.SessionImpl.byId(SessionImpl.java:1097)
at org.hibernate.internal.SessionImpl.get(SessionImpl.java:980)
at com.cms.dao.daoimpl.LogindtlDaoImpl.findById(LogindtlDaoImpl.java:117)
at com.cms.service.serviceimpl.LoginServiceImpl.userAuthentication(LoginServiceImpl.java:22)
at com.cms.controller.LoginController.handleRequest(LoginController.java:37)
at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:50)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:969)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:860)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:845)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:521)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1096)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:674)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
-----------------------------------------------------------------------------------------------------
please help me into this...