wood burning stoves*
The moose likes Object Relational Mapping and the fly likes persist() null pointer exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "persist() null pointer exception" Watch "persist() null pointer exception" New topic
Author

persist() null pointer exception

Alan Smith
Ranch Hand

Joined: Oct 19, 2011
Posts: 152

Hi,

I have yet been able to insert a record into a table using the Entitymanager. Everytime I use the persist method I get a null pointer exception. I have a person entity with id(auto incrememted), name, job, salary,description, countyId(foreign key) in a MySql table call Person. My servlet creates a Manager class and passes in parameters submitted representing Person information.



The manager class looks like this:



The PersonFacade class i am using is a netbeans generated session bean:



and AbstractFacade is as follows:


edit: Person entity class



I can read person entries from the database using the personFacades findAll() method but I can't write to it using the create() method without a null pointer exception showing up. All the objects I use are not pointing to a null reference so I can't get my head around it! I have seen examples all over the net that use the persist method. Could someone please help?

Thanks
James Sutherland
Ranch Hand

Joined: Oct 01, 2007
Posts: 553
Please include the exception stack trace.

TopLink : EclipseLink : Book:Java Persistence : Blog:Java Persistence Performance
 
 
subject: persist() null pointer exception
 
Similar Threads
Can't find method javax.persistence.criteria.CriteriaBuilder - Hibernate 3.5.1-Final
javax.persistence.criteria cannot be resolved to a type & project could not be used in the server.
Override AbstractFacade ?!
Incorrect hibernate version or maven ignore and didn't download hibernate jar file.
Can't find method javax.persistence.criteria.CriteriaBuilder - Hibernate 3.5.1-Final