| Author |
QuerySyntaxException class is not mapped
|
Kenneth Rene Sanchez Sanchez
Greenhorn
Joined: Jul 10, 2008
Posts: 3
|
|
Hi, I have a jar file (acad.jar) than contain TemaIcfes Entity: package co.academico.entidades; import java.io.Serializable; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; import javax.persistence.GeneratedValue; import org.jboss.seam.annotations.Name; @Entity @Name("TemaIcfes") @Table(name = "temas_icfes") public class TemaIcfes implements Serializable{ @Id @GeneratedValue private short tema; private String descripcion_tema; public short getTema(){ return tema; } public void setTema(short tema){ this.tema = tema; } public String getDescripcion_tema(){ return descripcion_tema; } public void setDescripcion_tema(String descripcion_tema){ this.descripcion_tema = descripcion_tema; } } The problem is that when I use it in another application through an EJB shows the following error: Exception during request processing: Caused by javax.el.ELException with message: "javax.ejb.EJBTransactionRolledbackException: org.hibernate.hql.ast.QuerySyntaxException: TemaIcfes is not mapped [SELECT a FROM TemaIcfes a ORDER BY tema]" Classes: HacerMantenimiento.java: package co.academico.admin; import java.util.List; import co.academico.entidades.TemaIcfes; import javax.ejb.Local; @Local public interface HacerMantenimiento{ public void crear(TemaIcfes tema); public List<TemaIcfes> consultarTemaIcfes(); public void modificar(TemaIcfes tema); public void listar(); public void eliminar(TemaIcfes tema); public void destroy(); } HacerMantenimientoEJB.java: package co.academico.admin; import static org.jboss.seam.ScopeType.SESSION; import java.util.List; import co.academico.entidades.TemaIcfes; import org.jboss.seam.annotations.Destroy; import org.jboss.seam.annotations.Name; import org.jboss.seam.annotations.Scope; import org.jboss.seam.annotations.datamodel.DataModel; import javax.ejb.Remove; import javax.ejb.Stateful; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; @Stateful @Scope(SESSION) @Name("hacerMantenimiento") public class HacerMantenimientoEJB implements HacerMantenimientoTemaIcfes{ @PersistenceContext private EntityManager em; @DataModel private List<TemaIcfes> temasIcfes; public void crear(TemaIcfes tema){ em.persist(tema); } public List<TemaIcfes> consultarTemaIcfes(){ temasIcfes = em.createQuery ("SELECT a "+ "FROM TemaIcfes a "+ "ORDER BY tema").getResultList(); return temasIcfes; } public void modificar(TemaIcfes tema){ em.merge(tema); em.flush(); } public void listar(){} public void eliminar(TemaIcfes tema){ em.remove(tema); } @Remove @Destroy public void destroy(){} } home.xhtml: <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:s="http://jboss.com/products/seam/taglib" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:rich="http://richfaces.org/rich" template="layout/template.xhtml"> <ui efine name="body"> <h:messages globalOnly="true" styleClass="message"/> <rich anel> <div class="section" style=" width : 593px;"> <h utputText value="No existen temas registrados" rendered="#{temasIcfes != null and temasIcfes.rowCount==0}"/> <h ataTable id="temasIcfes" value="#{temasIcfes}" var="tema" rendered="#{temasIcfes.rowCount>0}" style=" width : 377px;"> <h:column> <f:facet name="header">Codigo</f:facet> #{tema.tema} </h:column> <h:column> <f:facet name="header">Descripcion</f:facet> #{tema.descripcion_tema} </h:column> </h ataTable> </div> </rich anel> </ui efine> </ui:composition> pages.xml: ... <page view-id="/home.xhtml" action="#{hacerMantenimiento.consultarTemaIcfes}"> <navigation> <rule if="#{identity.loggedIn}"> <redirect view-id="/main.xhtml"/> </rule> </navigation> </page> ... persistence.xml: <?xml version="1.0" encoding="UTF-8"?> <!-- Persistence deployment descriptor for prod profile --> <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0"> <persistence-unit name="admisiones"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <jta-data-source>java:/admisionesDatasource</jta-data-source> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.InformixDialect"/> <property name="hibernate.show_sql" value="true"/> <property name="hibernate.format_sql" value="true"/> <property name="jboss.entity.manager.factory.jndi.name" value="java:/admisionesEntityManagerFactory"/> </properties> </persistence-unit> </persistence> What is the problem? They could help to solve this problem please?
|
 |
Jaikiran Pai
Marshal
Joined: Jul 20, 2005
Posts: 8147
|
|
|
Where is the persistence.xml file located? Is it inside the META-INF folder of acad.jar?
|
[My Blog] [JavaRanch Journal]
|
 |
Kenneth Rene Sanchez Sanchez
Greenhorn
Joined: Jul 10, 2008
Posts: 3
|
|
|
Yes, persistence.xml is inside of META-INF of acad.jar
|
 |
 |
|
|
subject: QuerySyntaxException class is not mapped
|
|
|