-->
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.  [ 6 posts ] 
Author Message
 Post subject: Error performing load command
PostPosted: Sun Feb 08, 2009 4:50 am 
Newbie

Joined: Sun Feb 08, 2009 4:33 am
Posts: 8
Hi everybody ,
I am new to hibernate
I am using eclipse ,Mysql and hibernate 3.2.3
I have a simple application to save and load from sql.
I have department class

Code:
package helper;

public class Department {

   private int id;
   private String name;
   
   public Department(String name){
      this.name=name;
   }
   public int getId() {
      return id;
   }
   public void setId(int id) {
      this.id = id;
   }
   public String getName() {
      return name;
   }
   public void setName(String name) {
      this.name = name;
   }
}



and here is the mapping file

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="helper">
<class name="helper.Department"
table="department_table">
<id name="id"
column="department_id"
type="int">
<generator class="native"/>
</id>

<property name="name"
column="department_name"
type="string"/>

</class>
</hibernate-mapping>



and here comes the problem ,when i run this code

SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
Session newSession = sessionFactory.openSession();
Transaction newTransaction = newSession.beginTransaction();
Query query=newSession.createQuery("from Department as dept order by dept.id asc");
Iterator iter =query.iterate();
if(iter.hasNext())deptVector=new Vector();
while ( iter.hasNext() ) {
Department dep = (Department) iter.next(); //here is the error
//deptVector.add(dep);
}


when i reach this line i get this error

INFO: Error performing load command
org.hibernate.HibernateException: Javassist Enhancement failed: helper.Department
at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.getProxy(JavassistLazyInitializer.java:142)
at org.hibernate.proxy.pojo.javassist.JavassistProxyFactory.getProxy(JavassistProxyFactory.java:72)
at org.hibernate.tuple.entity.AbstractEntityTuplizer.createProxy(AbstractEntityTuplizer.java:402)
at org.hibernate.persister.entity.AbstractEntityPersister.createProxy(AbstractEntityPersister.java:3483)
at org.hibernate.event.def.DefaultLoadEventListener.createProxyIfNecessary(DefaultLoadEventListener.java:298)
at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:219)
at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:126)
at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:905)
at org.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:873)
at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:590)
at org.hibernate.type.EntityType.resolve(EntityType.java:412)
at org.hibernate.type.EntityType.nullSafeGet(EntityType.java:227)
at org.hibernate.impl.IteratorImpl.next(IteratorImpl.java:135)
at main.GetAllDepartmentsServlet.doGet(GetAllDepartmentsServlet.java:37)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:627)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:875)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.InstantiationException: helper.Department_$$_javassist_0
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.getProxy(JavassistLazyInitializer.java:139)
... 29 more


any ideas please??
i even do not know what is javassit??


Thanks in advance


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 09, 2009 8:29 am 
Expert
Expert

Joined: Fri Jan 30, 2009 1:47 am
Posts: 292
Location: Bangalore, India
The problem is with your bean; its not having a no-argument constructor.

_________________
Regards,
Litty Preeth


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 09, 2009 8:42 am 
Newbie

Joined: Sun Feb 08, 2009 4:33 am
Posts: 8
Hi Litty,

Thank you so much ,your answer solved my problem.


Top
 Profile  
 
 Post subject: Re: Error performing load command
PostPosted: Tue Feb 09, 2010 2:18 pm 
Newbie

Joined: Thu Feb 04, 2010 2:30 pm
Posts: 3
I am getting a similar error and don't know what to do.

09:54:35,679 INFO DefaultLoadEventListener:109 - Error performing load command
org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.bd.syndication.model.User#7]



Thanks,
Deepak.


Top
 Profile  
 
 Post subject: Re: Error performing load command
PostPosted: Wed Feb 10, 2010 8:48 am 
Expert
Expert

Joined: Tue May 13, 2008 3:42 pm
Posts: 919
Location: Toronto & Ajax Ontario www.hibernatemadeeasy.com
Check to see if a User with an id of 7 exists in your database. I'm guessing it doesn't.

_________________
Cameron McKenzie - Author of "Hibernate Made Easy" and "What is WebSphere?"
http://www.TheBookOnHibernate.com Check out my 'easy to follow' Hibernate & JPA Tutorials


Top
 Profile  
 
 Post subject: Re: Error performing load command
PostPosted: Wed May 19, 2010 10:44 am 
Pro
Pro

Joined: Mon Apr 16, 2007 8:10 am
Posts: 246
@Cameron

If it indeed doesn't exist in the database, what course of action to take ?

I'm trying to test that a record does not exist in a table after a delete.

Is this the way to go ?

Code:
      Integer addressId = user.getAddress().getId();
      userDao.makeTransient(user);
      Address loadedAddress = null;
      try {
         loadedAddress = addressDao.findById(addressId, false);
      } catch (ObjectNotFoundException e) {

      }


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

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.