Hi All,
I get an Error when i run the a Select Query from My java class.
The trace is
org.hibernate.hql.ast.QuerySyntaxError: Employee_Master is not mapped. [From Employee_Master where employeeId= 'askari'and employeePwd='mehdi'] at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:63) at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:196) at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:130) at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:83) at org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:424) at org.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:870) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:820) at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74) at org.helpdesk.hibernate.HelpDeskTrancation.LoginUser(HelpDeskTrancation.java:36) at org.helpdesk.ejb.HelpDeskSessionBean.LoginUser(HelpDeskSessionBean.java:105) 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:585) at org.jboss.invocation.Invocation.performCall(Invocation.java:345) at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:214) at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:185) at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:130) at org.jboss.webservice.server.ServiceEndpointInterceptor.invoke(ServiceEndpointInterceptor.java:51) at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:48) at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:105) at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:335) at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:166) at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:139) at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192) at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122) at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:624) at org.jboss.ejb.Container.invoke(Container.java:873) 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:585) at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141) at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80) at org.jboss.mx.server.Invocation.invoke(Invocation.java:72) at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249) at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644) at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:155) at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:104) at org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:179) at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:165) at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46) at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:55) at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:97) at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:86) at $Proxy60.LoginUser(Unknown Source) at com.helpdesk.Ticket.TicketMaster.LoginUser(TicketMaster.java:16) at com.helpdesk.servlets.HelpDeskActionController.doPost(HelpDeskActionController.java:76) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at javax.servlet.http.HttpServlet.service(HttpServlet.java:810) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39) at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:153) at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112) at java.lang.Thread.run(Thread.java:595) Caused by: Employee_Master is not mapped.
My Mapping File is
<hibernate-mapping package="org.helpdesk.hibernate">
<class name="EmployeeMaster" table="Employee_Master"> <id name="employeeId" column="Employee_ID" type="string"> <generator class="assigned"/> </id> <property name="employeePwd" column="Employee_Pwd" type="string" /> <property name="emplyeeRole" column="Emplyee_Role" type="string" /> <property name="employeeDept" column="Employee_Dept" type="string" /> <property name="employeeEmail" column="Employee_Email" type="string" /> <property name="employeeTelephone" column="Employee_Telephone" type="long" /> </class> </hibernate-mapping>
The Piece Of Code is
session = factory.openSession(); tx = session.beginTransaction(); Query getEmpDetail= session.createQuery("From Employee_Master where employeeId= '"+ Uname+"'and employeePwd='"+pwd+"'"); List login= (List) getEmpDetail.list();
for (Iterator iter = login.iterator(); iter.hasNext();) { // Login honey = (Login) iter.next(); empMaster=(EmployeeMaster)iter.next(); System.out.println("Id " + empMaster.getEmployeeId() + " Name "+ empMaster.getEmplyeeRole()); }
I have been doing all soughts of thing ,but its not working out.
Please help me out
Thanks in advance.
Mehdi
|