Problem while calling Configuration constructor (Hibernate)

G

Giox

Hello everybody,
I'm trying to use for the first time hibernate so if my question is
dumb, please let me now.
I would like to perform some simple task through hibernate and
therefore I generated hbm.xml, java and mapping file through JBOSS
Eclipse starting from a pre existing database.
When I try to perform configuration my system stop working. In order to
implement configuration I use the ollowing class:

public class init_system {

/** Creates a new instance of init_system */
public init_system() {
}

public static void initialization()
{
try
{
Configuration cfg = new Configuration(); LINE A


//------------------------------------------------------------------------
// Test x HIBERNATE
cfg.addClass(com.biz.hibernate.Money.class);
cfg.addClass(com.biz.hibernate.Useraccesstable.class);
cfg.addClass(com.biz.hibernate.Userinfo.class);

SessionFactory factory = cfg.buildSessionFactory();

// FINE Test x HIBERNATE
}
catch(HibernateException ex1)
{
ex1.printStackTrace();
}
catch(Exception ex)
{
System.out.println("Merda");
}
}
}


When I try to use the initialization() method from inside a web
application, the code run until LINE A, and then stops (also the
JavaBean calling it). However it doesn't enter the catch instructions.
The initialization method is called inside a JavaBean used by a JSP
page. I know this is not the correct way to perform the configuration
task because this is a heavy task, however, can this explain the error
in my code?
Please note that my code doesn't reach the cfg.AddClass()
Thanks a lot Gio
 
G

Giox

Hello,
I found it out, I forgot some .jar file Hibernate related.
Thanks Gio

Giox ha scritto:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,981
Messages
2,570,188
Members
46,733
Latest member
LonaMonzon

Latest Threads

Top