Well.... , okay,...that's right, and I already changed that, and I'm getting an new Error Message:
NoSuchMethodError:
org.hibernate.mapping.PersistentClass.setDynamic(Z)V[b]
And this message is really weired, because I looked at the source code of PersistentClass, and this method really doesn't exist. Only setDynamixInsert and setDynamicUpdate exists (I'm not sure with the names).
[b]Code between sessionFactory.openSession() and session.close():
Code:
public static void main(String[] args) throws HibernateException,
SQLException {
//create session
Session session = HibernateUtil.currentSession();
//examples of using database with Contacts
//examplesContact(session);
//exapmles of using database with Folders
//examplesFolder(session);
// close Session
HibernateUtil.closeSession();
System.exit(0);
}
And thats class HibernateUtil 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);
}
}
.
.
.
.
[/code]
Full stack trace of any exception that occurs:
Initial SessionFactory creation failed.java.lang.NoSuchMethodError:
org.hibernate.mapping.PersistentClass.setDynamic(Z)V Exception in
thread "main" java.lang.ExceptionInInitializerError
at main.HibernateUtil.<clinit>(HibernateUtil.java:36)
at main.Shell.main(Shell.java:34)
Caused by: java.lang.NoSuchMethodError:
org.hibernate.mapping.PersistentClass.setDynamic(Z)V
at org.hibernate.cfg.AnnotationBinder.bindEntity(AnnotationBinder.java:514)
at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:278)
at org.hibernate.cfg.AnnotationConfiguration.addAnnotatedClass(AnnotationConfiguration.java:44)
at org.hibernate.cfg.AnnotationConfiguration.parseMappingElement(AnnotationConfiguration.java:182)
at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1353)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1335)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1302)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1230)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1216)
at main.HibernateUtil.<clinit>(HibernateUtil.java:27)
... 1 more
Regards,
Martin
[/b]