This week's book / license giveaways are in the JDBC and Relational Databases and Java in General forums.
We're giving away four copies each of PostGIS in Action and Java Advanced Topics Training and have the authors on-line!
See this thread and this one for details.
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


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: 184

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: persist() null pointer exception