*
The moose likes Object Relational Mapping and the fly likes DAO can't get call and get Nullpointer exception? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "DAO can Watch "DAO can New topic
Author

DAO can't get call and get Nullpointer exception?

Nakataa Kokuyo
Ranch Hand

Joined: Jul 24, 2011
Posts: 184
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

Joined: Jul 24, 2011
Posts: 184
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.
 
subject: DAO can't get call and get Nullpointer exception?
 
Similar Threads
How does Spring handle find(PrimaryKey pk) when an entity is not found ?
converting a string color to an object color
Generics version of "new T()"?
java.lang.Class cannot be cast to java.lang.reflect.ParameterizedType
Problem in stateless session bean with JSF