Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
hello, i am experiencing a problem:
"org.hibernate.exception.SQLGrammarException: could not load an entity: [vista.PersonaBO#1]"
What is it?
Hibernate version:
3.1.1
Mapping documents:
“PersonaBO.hbm.xml”
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="vista.PersonaBO" table="persons">
<id name="id" type="integer" column="id" unsaved-value="-1">
<generator class="identity"/>
</id>
<property name="nombre"
column="nombre"
type="string"/>
<property name="apellido"
column="apellido"
type="string"/>
<property name="edad"
column="edad"
type="integer"/>
<property name="estadoCivil"
column="estadoCivil"
type="string"/>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
session = sessionFactory.openSession();
personaBO = (PersonaBO)session.get(PersonaBO.class,id1);
session.close();
Full stack trace of any exception that occurs:
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)
Name and version of the database you are using:
MySQL 5.0
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
...and i have got
- Tomcat 5.5.12
- mysql-connector-java-3.0.11-stable-bin.jar
- the files "persons.frm" and "db.opt" in web-inf/classes/personas
Bye, bye