hibernate - no puede cargarse entidad

estebanja
04 de Abril del 2006
Buenas.....al ejecutar una aplicaciòn (con el tomcat) que usa hibernate - struts, la cual debe conectarse a mySQL, me aparece:

org.hibernate.exception.SQLGrammarException: could not load an entity: [vista.PersonaBO#1]

PersonaBO.java es un java-bean

La pila de errores completa es:

type Informe de Excepción
mensaje
descripción El servidor encontró un error interno () que hizo que no pudiera rellenar este requerimiento.
excepción
javax.servlet.ServletException
org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:523)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
causa raíz
exceptions.DatastoreException
exceptions.DatastoreException.datastoreError(DatastoreException.java:28)
SearchPersonAction3.execute(SearchPersonAction3.java:67)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
causa raíz
exceptions.DatastoreException
exceptions.DatastoreException.datastoreError(DatastoreException.java:28)
PersonsManager2.getPersona(PersonsManager2.java:40)
SearchPersonAction3.execute(SearchPersonAction3.java:38)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
causa raíz
org.hibernate.exception.SQLGrammarException: could not load an entity: [vista.PersonaBO#1]
org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:65)
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
org.hibernate.loader.Loader.loadEntity(Loader.java:1799)
org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:93)
org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:81)
org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:2730)
org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:365)
org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:346)
org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:123)
org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:177)
org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:87)
org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:889)
org.hibernate.impl.SessionImpl.get(SessionImpl.java:826)
org.hibernate.impl.SessionImpl.get(SessionImpl.java:819)
PersonsManager2.getPersona(PersonsManager2.java:33)
SearchPersonAction3.execute(SearchPersonAction3.java:38)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


-----------------------------------
“PersonaBO.hbm.xml”

<?xml version="1.0"?>
<!-- <!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd"> -->

<hibernate-mapping>
<class name="PersonaBO" table="persons">
<id name="id" column="id" type="java.lang.Integer" unsaved-value="null">
<generator class="native"/>
</id>
<property name="nombre" column="nombre" type="java.lang.String"/>
<property name="apellido" column="apellido" type="java.lang.String"/>
<property name="edad" column="edad" type="java.lang.Integer"/>
<property name="estadoCivil" column="estadoCivil" type="java.lang.String"/>
</class>
</hibernate-mapping>




---------------------------------------

“hibernate.cfg.xml”

<?xml version=\'1.0\' encoding=\'utf-8\'?>
<!DOCTYPE hibernate-configuration
PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>

<session-factory>
<property name="connection.driver_class">com.mysql.jdbc.Driv er</property>
<property name="connection.url">jdbc:mysql://localhost/personas</property>
<property name="connection.username">admin</property>
<property name="connection.password"></property>
<property name="dialect">net.sf.hibernate.dialect.MySQLDiale ct</property>
<property name="use_outer_join">true</property>
<property name="transaction.factory_class">net.sf.hibernate. transaction.JDBCTransactionFactory</property>
<property name="show_sql">true</property>

<!-- Mapping files -->
<mapping resource="PersonaBO.hbm.xml"/>
</session-factory>

</hibernate-configuration>

------------
"PersonsManager2.java"
"AQUÌ USO HQL"

public class PersonsManager2 implements IManejadorPersonas
{

SessionFactory sessionFactory = null;

public PersonsManager2()throws DatastoreException
{
init();

}

public PersonaBO getPersona(String id1)throws DatastoreException
{
PersonaBO personaBO = null;

Session session = null;

try
{
session = sessionFactory.openSession();

personaBO = (PersonaBO)session.get(PersonaBO.class,id1);

session.close();

}catch (Exception ex)
{
ex.printStackTrace();
throw DatastoreException.datastoreError(ex);
}


return personaBO;


}

private void init()throws DatastoreException
{
try
{
sessionFactory=new Configuration().configure().buildSessionFactory();

}catch(Exception ex){
throw DatastoreException.datastoreError(ex);
}
}


}



-------------------
PersonaBO.class està en web-inf/classes/vista

Los archivos de la base de datos estàn estàn en: web-inf/classes/personas

----------
BaseBussinessObject es java-bean y es el padre de PersonaBO
"BaseBussinessObject.java"

package vista;
import java.io.*;

abstract public class BaseBussinessObject implements Serializable
{
private Integer id;


public Integer getId()
{
return id;
}

public void setId(Integer id)
{
this.id=id;
}


}

------------------------
"PersonaBO.java"

package vista;

public class PersonaBO extends BaseBussinessObject
{
private String nombre;
private String apellido;
private Integer edad;
private String estadoCivil;

public PersonaBO(){
super();
}
public String getApellido() {
return apellido;
}
public void setApellido(String apellido) {
this.apellido = apellido;
}
public Integer getEdad() {
return edad;
}
public void setEdad(Integer edad) {
this.edad = edad;
}
public String getEstadoCivil() {
return estadoCivil;
}
public void setEstadoCivil(String estadoCivil) {
this.estadoCivil = estadoCivil;
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
}

Realmente no me doy cuenta què tengo que hacer.....serà el hibernate.cfg.xml o alguna ubicaciòn erronea en particular de algùn archivo?

Gracias y Saludos a todos