• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

DAO can't get call and get Nullpointer exception?

 
Nakataa Kokuyo
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good day,

I'm new in JPA and i have below class intend to save a record, it is running @onetoone relationship between student and contact class, When i do a test run and i got nullpointerexception error on line 13 under Studentanager.class, appreciated your enlightenment.

P/S : Suspect missing out some implementation, hope someone can guide me out here, caused the Entity Manager always Null.

StudentManager class :


StudentDAOImpl class :





Persistence.xml reside in META-INF folder



My Test case :
 
Nakataa Kokuyo
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just in case in future someone having similar issue, this can be resolve by using ClassPathXmlApplicationContext if you do not using jUnit for the testing.

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic