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

Discussion in 'Java' started by RC, May 1, 2008.

  1. RC

    RC Guest

    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!
     
    RC, May 1, 2008
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ilias Lazaridis
    Replies:
    0
    Views:
    1,773
    Ilias Lazaridis
    Dec 27, 2004
  2. Replies:
    0
    Views:
    3,809
  3. jstorta
    Replies:
    1
    Views:
    11,848
  4. Eleanna Skouta
    Replies:
    2
    Views:
    8,513
    Arne Vajhøj
    Dec 9, 2008
  5. Amit Jain
    Replies:
    7
    Views:
    3,393
    Amit Jain
    Apr 27, 2009
Loading...

Share This Page