java - Hibernate Mapping Issue Tomcat8 -




i'm having problem mapping in hibernate , tomcat 8.

when deploy application(through manager/html or creating new folder , putting whole project) there not problem if try put classes web-inf of existing application , run it, log says:

org.hibernate.hql.internal.ast.querysyntaxexception: telefonos not mapped [from telefonos canal = :canal , (fechatomado null or (fechatomado + 90) >= getdate())] @ org.hibernate.hql.internal.ast.querysyntaxexception.generatequeryexception(querysyntaxexception.java:96) @ org.hibernate.queryexception.wrapwithquerystring(queryexception.java:120) @ org.hibernate.hql.internal.ast.querytranslatorimpl.docompile(querytranslatorimpl.java:234) @ org.hibernate.hql.internal.ast.querytranslatorimpl.compile(querytranslatorimpl.java:158) @ org.hibernate.engine.query.spi.hqlqueryplan.<init>(hqlqueryplan.java:126) @ org.hibernate.engine.query.spi.hqlqueryplan.<init>(hqlqueryplan.java:88) @ org.hibernate.engine.query.spi.queryplancache.gethqlqueryplan(queryplancache.java:190) @ org.hibernate.internal.abstractsessionimpl.gethqlqueryplan(abstractsessionimpl.java:301) @ org.hibernate.internal.abstractsessionimpl.createquery(abstractsessionimpl.java:236) @ org.hibernate.internal.sessionimpl.createquery(sessionimpl.java:1796) @ operaciones.telefonoscvts.manejadortelefonos.listtelefonos(manejadortelefonos.java:133) @ org.apache.jsp.comercial.comercial.ajax.traenumero_jsp._jspservice(traenumero_jsp.java:123) @ org.apache.jasper.runtime.httpjspbase.service(httpjspbase.java:70) @ javax.servlet.http.httpservlet.service(httpservlet.java:729) @ org.apache.jasper.servlet.jspservletwrapper.service(jspservletwrapper.java:438) @ org.apache.jasper.servlet.jspservlet.servicejspfile(jspservlet.java:396) @ org.apache.jasper.servlet.jspservlet.service(jspservlet.java:340) @ javax.servlet.http.httpservlet.service(httpservlet.java:729) @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:291) @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:206) @ org.apache.tomcat.websocket.server.wsfilter.dofilter(wsfilter.java:52) @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:239) @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:206) @ org.apache.catalina.core.standardwrappervalve.invoke(standardwrappervalve.java:212) @ org.apache.catalina.core.standardcontextvalve.invoke(standardcontextvalve.java:106) @ org.apache.catalina.authenticator.authenticatorbase.invoke(authenticatorbase.java:502) @ org.apache.catalina.core.standardhostvalve.invoke(standardhostvalve.java:141) @ org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:79) @ org.apache.catalina.valves.abstractaccesslogvalve.invoke(abstractaccesslogvalve.java:616) @ org.apache.catalina.core.standardenginevalve.invoke(standardenginevalve.java:88) @ org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:521) @ org.apache.coyote.http11.abstracthttp11processor.process(abstracthttp11processor.java:1096) @ org.apache.coyote.abstractprotocol$abstractconnectionhandler.process(abstractprotocol.java:674) @ org.apache.tomcat.util.net.nioendpoint$socketprocessor.dorun(nioendpoint.java:1500) @ org.apache.tomcat.util.net.nioendpoint$socketprocessor.run(nioendpoint.java:1456) @ java.util.concurrent.threadpoolexecutor.runworker(unknown source) @ java.util.concurrent.threadpoolexecutor$worker.run(unknown source) @ org.apache.tomcat.util.threads.taskthread$wrappingrunnable.run(taskthread.java:61) @ java.lang.thread.run(unknown source) caused by: org.hibernate.hql.internal.ast.querysyntaxexception: telefonos not mapped 

teléfonos entity

package operaciones.telefonoscvts.dao;  import java.io.serializable; import javax.persistence.*;  @entity @table(name = "telefonos_cvts") public class telefonos implements serializable {  @id @generatedvalue(strategy = generationtype.identity) @column(name = "id") private int id;  @column(name = "telefono") private string telefono;  @column(name = "modalidad") private string modalidad;  @column(name = "canal") private string canal;  @column(name = "fechacarga") private string fechacarga;  @column(name = "fechatomado") private string fechatomado;  public telefonos() { }  //get , set methods 

i tried many ways make work it, packages fine, hibernate.cfg.xml it's read, don't know why app it's losing mappings. anny appreciated.

hibernate: 4.3

thanks!!

i see mapping correct. probable solution check whether have included entity hibernate configuration:

@bean public localsessionfactorybean sessionfactory() {     localsessionfactorybean lsfb = new localsessionfactorybean();     lsfb.setdatasource(this.datasource());     lsfb.setpackagestoscan(new string[] {          "operaciones.telefonoscvts.dao"     });     lsfb.sethibernateproperties(this.hibernateproperties());     return sessionfactory; } 

the same effect can achieve using xml based configuration. find annotations better in case.

<bean id="sessionfactory" class="org.springframework.orm.hibernate4.localsessionfactorybean" >     <property name="datasource" ref="datasource"/>     <property name="packagestoscan">         <list>             <value>operaciones.telefonoscvts.dao</value>         </list>     </property>     <property name="hibernateproperties">         <props>             <prop key="hibernate.dialect">${hibernate.dialect}</prop>             <prop key="hibernate.show_sql">${hibernate.show_sql:false}</prop>             <prop key="hibernate.format_sql">${hibernate.format_sql:false}</prop>         </props>     </property>        </bean> 

source: websystique

moreover, recommend more file telefonos.java package operaciones.telefonoscvts.entity (or model) separately classes responsible communication database.





wiki

Comments

Popular posts from this blog

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -

Asterisk AGI Python Script to Dialplan does not work -