Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

toplink session readobject nullpointerexception

 
gilbert engle
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
toplink session readobject nullpointerexception

Are you looking for these keywords?

You will get a nullpointerexception from session.readObject if you don't include a setter method for your class.

DirectToFieldMapping somethingIntValueMapping = new DirectToFieldMapping();
somethingIntValueMapping.setAttributeName("intValue");
somethingIntValueMapping.setGetMethodName("getIntValue");
somethingIntValueMapping.setSetMethodName("setIntValue"); // gotta have this!
somethingIntValueMapping.setFieldName("EGOV_IAC.SOMETHING.INTVALUE");
somethingIntValueMapping.readOnly();
descriptor.addMapping(somethingIntValueMapping);

When you call readObject this is a request to read an object from the database. It is required that you provide setter methods for ALL object data attributes so that the readObject method can do its job

Session.readObject should be able to detect this problem and give you a meaningful Exception to work with, but it does not. I spent a long time on this one!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic