aspose file tools*
The moose likes Object Relational Mapping and the fly likes toplink session readobject nullpointerexception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "toplink session readobject nullpointerexception" Watch "toplink session readobject nullpointerexception" New topic
Author

toplink session readobject nullpointerexception

gilbert engle
Greenhorn

Joined: Jun 03, 2009
Posts: 24
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.
 
subject: toplink session readobject nullpointerexception