[jboss-jira] [JBoss JIRA] Created: (EJBTHREE-1441) QuerySyntaxException class is not mapped

Kenneth René Sánc Kenneth René Sánc
Wed Jul 16 16:44:52 EDT 2008


QuerySyntaxException class is not mapped
----------------------------------------

                 Key: EJBTHREE-1441
                 URL: https://jira.jboss.org/jira/browse/EJBTHREE-1441
             Project: EJB 3.0
          Issue Type: Task
         Environment: JBoss 4.2.0.GA - Seam 2.0.1.GA
            Reporter: Kenneth René Sánchez Sánchez


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:define name="body"> 

<h:messages globalOnly="true" styleClass="message"/> 

<rich:panel> 
<div class="section" style=" width : 593px;"> 
<h:outputText 
value="No existen temas registrados" 
rendered="#{temasIcfes != null and temasIcfes.rowCount==0}"/> 

<h:dataTable 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:dataTable> 
</div> 
</rich:panel> 

</ui:define> 
</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?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       




More information about the jboss-jira mailing list