-->
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.  [ 3 posts ] 
Author Message
 Post subject: wierd hibernate / junit interaction
PostPosted: Mon Jun 20, 2005 9:28 pm 
Newbie

Joined: Mon Jun 20, 2005 9:19 pm
Posts: 2
so i am calling the same method from 2 different locations in my junit test. from the 1st location (outside of the junit test class, from the constructor of anther class) it works. thats how i got the sql output below. from within junit test method, calling that same method (ie addNew) fails. ive tried both reloading and non-loading testrunners.

any ideas?

thx
mike



Hibernate version:
3.0.5

Mapping documents:

Code between sessionFactory.openSession() and session.close():
public void addNew(Object o) {
session = xxx.Hibernate.currentSession();
Transaction transaction = session.beginTransaction();
session.save(o);
transaction.commit();
xxx.Hibernate.closeSession();
}


Full stack trace of any exception that occurs:
java.lang.ClassNotFoundException: org.hibernate.SQL
at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:141)
at xxx.LogAppender.append(PipelineLogAppender.java:27)
at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:221)
at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:57)
at org.apache.log4j.Category.callAppenders(Category.java:187)
at org.apache.log4j.Category.forcedLog(Category.java:372)
at org.apache.log4j.Category.log(Category.java:864)
at org.apache.commons.logging.impl.Log4JLogger.debug(Log4JLogger.java:110)
at org.hibernate.jdbc.AbstractBatcher.log(AbstractBatcher.java:324)
at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:375)
at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:76)
at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:69)
at org.hibernate.jdbc.AbstractBatcher.prepareBatchStatement(AbstractBatcher.java:150)
at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:1839)
at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:2200)
at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:46)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:223)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:136)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:274)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:730)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:324)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:86)
at xxx.Hibernate.addNew(Hibernate.java:49)



Name and version of the database you are using:
mysql 4.1

The generated SQL (show_sql=true):
Hibernate: insert into TABLE_GROUP (desiredGroupPriorityValue, desiredProcessorAllocation, filePermissionType, filePermissionSerial, name) values (?, ?, ?, ?, ?)


Debug level Hibernate log excerpt:


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 20, 2005 10:34 pm 
Senior
Senior

Joined: Thu May 12, 2005 11:40 pm
Posts: 125
Location: Canada
http://www.hibernate.org/119.html#A3


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 20, 2005 11:14 pm 
Newbie

Joined: Mon Jun 20, 2005 9:19 pm
Posts: 2
Nebob wrote:
http://www.hibernate.org/119.html#A3


tried both methods listed here. for #1, even edited the actual file in junit source and recompiled junit package. that only caused the error in the constructor as well.

using #2, at least it works in the constructor

any other suggestions?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.