-->
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.  [ 5 posts ] 
Author Message
 Post subject: Hibern8 3 newbie!
PostPosted: Fri Apr 15, 2005 4:55 pm 
Beginner
Beginner

Joined: Fri Apr 15, 2005 4:53 pm
Posts: 29
Hi,
I was wondering if there is a HibernateUtil class available for Hibernate 3 like there was one for Hibernate 2. I've just changed the import statements to point to new classes in the Util class but not sure yet if that'd work.

Any pointers?

thx.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 16, 2005 5:21 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Replacing the imports should be enough, although you don't need to catch and wrap exceptions anymore - H3 throws RuntimeExceptions.


Top
 Profile  
 
 Post subject: HibernateUtil
PostPosted: Tue Apr 19, 2005 8:51 pm 
Beginner
Beginner

Joined: Fri Apr 15, 2005 4:53 pm
Posts: 29
christian wrote:
Replacing the imports should be enough, although you don't need to catch and wrap exceptions anymore - H3 throws RuntimeExceptions.


thx chris,
I did it and now I see this exception:
java.lang.NoClassDefFoundError: net/sf/ehcache/CacheException
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2328)
at java.lang.Class.getConstructor0(Class.java:2640)
at java.lang.Class.newInstance0(Class.java:321)
at java.lang.Class.newInstance(Class.java:303)
at org.hibernate.cfg.SettingsFactory.createCacheProvider(SettingsFactory.java:262)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:184)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1505)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1053)
at com.xxx.util.HibernateUtil.<clinit>(HibernateUtil.java:34)

The code thats throwing this exception:
static {
//try {
configuration = new Configuration();
sessionFactory = configuration.configure().buildSessionFactory();
// We could also let Hibernate bind it to JNDI:
// configuration.configure().buildSessionFactory()
//} catch (Throwable ex) {
// We have to catch Throwable, otherwise we will miss
// NoClassDefFoundError and other subclasses of Error
//log.error("Building SessionFactory failed.", ex);
//throw new ExceptionInInitializerError(ex);
//}
}

Why is it still looking for old packages?

thanks


Top
 Profile  
 
 Post subject: Re: HibernateUtil
PostPosted: Tue Apr 19, 2005 10:17 pm 
Expert
Expert

Joined: Mon Feb 14, 2005 12:32 pm
Posts: 609
Location: Atlanta, GA - USA
1badpny wrote:
christian wrote:
Replacing the imports should be enough, although you don't need to catch and wrap exceptions anymore - H3 throws RuntimeExceptions.


thx chris,
I did it and now I see this exception:
java.lang.NoClassDefFoundError: net/sf/ehcache/CacheException
at java.lang.Class.getDeclaredConstructors0(Native Method)

Why is it still looking for old packages?

thanks


Chris,

The net.sf.ehcache.CacheException class is not part of Hibernate 3. It is part of EHCache. Therefore it's package naming didn't change and it's not in the hibernate3.jar, it's in the ehcache-1.1.jar. Check the list of dependencies and make sure you have them all in your classpath.


Top
 Profile  
 
 Post subject: Re: HibernateUtil
PostPosted: Wed Apr 20, 2005 12:18 am 
Newbie

Joined: Mon Apr 18, 2005 3:21 am
Posts: 5
1badpny wrote:

thx chris,
I did it and now I see this exception:
java.lang.NoClassDefFoundError: net/sf/ehcache/CacheException


Change your cache provider from
Code:
net.sf.ehcache.hibernate.Provider
to
Code:
org.hibernate.cache.EhCacheProvider


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.