Hello, I am new to Hibernate and I am having some trouble deleting objects from a database. For example all i am trying to do is extract an object from the DB using load, and then to delete it. (See my code exert below).
The error is
could not load an entity
The actual error refers to a table jboss.jboss_currentweight, when it should be jboss.currentweight
Hibernate version:
3.1
Mapping documents:
<class name="com.asif.myApps.server.pers.hibernate.pojo.MyWeight"
table="currentweight">
<id name="weightID" column="weightID" type="int" unsaved-value="null">
<generator class="assigned"/>
</id>
<property name="currentWeight">
<column name="currentWeight"/>
</property>
<property name="currentDate">
<column name="currentDate"/>
</property>
<property name="description">
<column name="description"/>
</property>
</class>
Code between sessionFactory.openSession() and session.close():
logger.info("Starting Transaction");
MyWeight myVO = (MyWeight) mySQLSession.load(MyWeight.class, weightID);
logger.info("About To Delete - " + myVO.getWeightID());
mySQLSession.delete(myVO);
Full stack trace of any exception that occurs:
23:44:18,334 WARN (JDBCExceptionReporter.java:71) [ logExceptions] - SQL Error: 1146, SQLState: 42S02
23:44:18,344 ERROR (JDBCExceptionReporter.java:72) [ logExceptions] - Table 'jboss.jboss_currentweight' doesn't exist
could not load an entity: [com.asif.myApps.server.pers.hibernate.pojo.MyWeight#1]
Name and version of the database you are using:
MySQL
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
|