-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: QuerySyntaxException class is not mapped
PostPosted: Thu Jul 10, 2008 4:02 pm 
Newbie

Joined: Thu Jul 10, 2008 4:00 pm
Posts: 1
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: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/ ... ce_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?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.