Hi togehter,
i use hibernate 3.0 and the newest version of hibernate annotations
My problem is the following: when i want to extend my class with DefaultDeleteEventListener i get the following error message (without the EventListener there is no problem...):
ERROR - could not complete schema update
org.hibernate.MappingException: Could not determine type for: org.apache.commons.logging.Log, for columns: [org.hibernate.mapping.Column(log)]
at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:244)
at org.hibernate.mapping.Column.getSqlTypeCode(Column.java:124)
at org.hibernate.mapping.Column.getSqlType(Column.java:168)
at org.hibernate.mapping.Table.sqlAlterStrings(Table.java:193)
at org.hibernate.cfg.Configuration.generateSchemaUpdateScript(Configuration.java:736)
at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:135)
at util.HibernateUtil.<clinit>(HibernateUtil.java:18)
at testcases.DeleteMomentIntervalTestCase.setUp(DeleteMomentIntervalTestCase.java:28)
at junit.framework.TestCase.runBare(TestCase.java:125)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:474)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:342)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:194)
My class, implementeting the Listener looks like that:
/**
* Stereotyp Moment-Interval
*/
@Entity(access = AccessType.FIELD)
@Table(name = "Uhr")
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public class Uhr extends DefaultDeleteEventListener
{
public void onDelete(DeleteEvent event) throws CallbackException {
super.onDelete(event);
}
}
My Class, opening the session looks like that:
public class HibernateUtil {
private static final SessionFactory sessionFactory;
private static final AnnotationConfiguration cfg;
static {
try {
cfg = new AnnotationConfiguration();
cfg.configure();
new SchemaUpdate(cfg).execute(true, true);
sessionFactory = cfg.buildSessionFactory();
} catch (Throwable ex) {
// Make sure you log the exception, as it might be swallowed
System.err.println("Initial SessionFactory creation failed." + ex);
throw new ExceptionInInitializerError(ex);
}
}
public static final ThreadLocal session = new ThreadLocal();
public static Session currentSession() throws HibernateException {
Session s = (Session) session.get();
// Open a new Session, if this Thread has none yet
if (s == null) {
s = sessionFactory.openSession();
session.set(s);
}
return s;
}
public static void closeSession() throws HibernateException {
Session s = (Session) session.get();
session.set(null);
if (s != null)
s.close();
}
}
In an extern test class, I call simply session = HibernateUtil.currentSession(); to open a new session.
And here i get the problem.
Can somebody help me?
|