-->
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: "could not load an entity" Error on delete
PostPosted: Tue Jan 24, 2006 8:00 pm 
Newbie

Joined: Tue Jan 24, 2006 7:50 pm
Posts: 11
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:


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.