• 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
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

persist() null pointer exception

 
Ranch Hand
Posts: 185
Netbeans IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 553
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please include the exception stack trace.
 
There's a city wid manhunt for this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic