Page 1 of 1

Brief Tutorial on getting Hibernate to work with Smartfox

Posted: 16 Oct 2009, 15:35
by starzero
http://ideacandi.com/blogzero/?p=34

Feel free to comment.

Thanks!

Posted: 17 Oct 2009, 08:47
by Lapo
Thank you. I have made your post a sticky.

org.hibernate.MappingNotFoundException

Posted: 26 Oct 2009, 16:17
by helloniklas
Hey, I'm new the Java world, so sorry for newbie question.

I have Hibernate hooked up and trying a simple test.

I get this exception

Exception in ExtensionHandler: org.hibernate.MappingNotFoundException: resource: net/pubpals/data/user/User.hbm.xml not found

Exception type: org.hibernate.MappingNotFoundException
org.hibernate.MappingNotFoundException: resource: net/pubpals/data/user/User.hbm.xml not found


Basically, I have a class called User in it's package in javaExtensions together with the User.hbm.xml but somehow it seems it doesn't find the mapping file.

It does load the hibernate.cfg.xml in which I have
<mapping resource="net/pubpals/data/user/User.hbm.xml"/>

Am I not suposed to keep my DAO classes in the javaExtensions folder? Just as the other java code for the extensions?

Posted: 26 Oct 2009, 16:56
by helloniklas
Ok, I now got this working, very nice...

It seems I had to put my classes in

Server/mypackage...

Rather then in javaExtensions/

Which I guess is correct then?

Any guidelines from someone experienced on as where to put stuff would be much appreciated.

Posted: 26 Oct 2009, 19:18
by starzero
Hi,

In your wrapper.conf file you should have a classpath delcaration similar to wrapper.java.classpath.3=/opt/SFS_PRO_1.6.6/Server/javaExtensions/. If not, then place that line in your file (noting the classpath.# format and the full path to your extensions folder).

The way you have it now is fine, but if you want to further separate your extension code from the smartfox server resources, then you can specify any path you would like in your wrapper. The important thing is that it is accessible from your classpath.

paul