Brief Tutorial on getting Hibernate to work with Smartfox

Post here your questions about Actionscript and Java server side extensions development.

Moderators: Lapo, Bax

Post Reply
starzero
Posts: 28
Joined: 19 Jun 2009, 18:41

Brief Tutorial on getting Hibernate to work with Smartfox

Post by starzero »

http://ideacandi.com/blogzero/?p=34

Feel free to comment.

Thanks!
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

Thank you. I have made your post a sticky.
Lapo
--
gotoAndPlay()
...addicted to flash games
helloniklas
Posts: 21
Joined: 14 Sep 2009, 10:18
Location: London
Contact:

org.hibernate.MappingNotFoundException

Post 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?
helloniklas
Posts: 21
Joined: 14 Sep 2009, 10:18
Location: London
Contact:

Post 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.
starzero
Posts: 28
Joined: 19 Jun 2009, 18:41

Post 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
Post Reply