Hibernate Configuration.addClass(tableClass) and Session.createCriteria(tableClass)

R

RC

I got run time error throw to NullPointerException
when I do
Configuration config = new Configuration();
config.addClass(myClassA.class).addClass(myClassB.class);

Why?

But I don't get any run time error when

do

SesstionFactory sf = config.buildSessionFactory();

Session session = sf.openSession();
List list =
session.createCriteria(myClassA).createCriteria(myClassB).list();

Instead session.createCriteria, I would like to try

List list = session.createQuery("....").list();

But I get run time error in config.addClass().

How to resolve this problem?

Thank you in advance!
 

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,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top