• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Piet Souris
  • Carey Brown
  • Stephan van Hulst
Bartenders:
  • Frits Walraven
  • fred rosenberger
  • salvin francis

Null Pointer Exception @ SessionFactory

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello to everyone,

I'm new to Hibernate. I just want to do a sample project with Hibernate. But I've been taking exceptions, I'll be happy if someone can help me..
Thanks in advance..

And here's my hibernate.cfg.xml file:

Full stacktrace:
 
author & internet detective
Posts: 40669
827
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Talha,
The exception says it is being thrown in line 30 in saveOrUpdate. Which line is line 30? If I had to guess, I would imagine it is one of the lines in the catch or finally block. You should have a null check so you aren't trying to rollback the transaction if it is null. In other words, if Hibernate fails on creating a session, the code throws a Null Pointer in the catch block and you don't know what the original exception is. The finally block should have a similar null check for session.
 
Talha Kabakus
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your reply Jeanne..

Now I'm taking another exception :

org.hibernate.MappingException: An AnnotationConfiguration instance is required to use <mapping clazz="model.Users"/>

Here's my Users class that is generated Hibernate tools..

 
I am going to test your electrical conductivity with this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic