views:

22

answers:

1

I'm quite new to Ibatis so I might be missing something, but I can't seem to be able to figure out why I'm getting this error.

I'm getting this error when I try to save a Person object which has a weapon reference variable. I know the person object isn't null since I validate the object to see if the weapon reference variable isn't null and since I checked the value in my debugger in Eclipse. Thanks to the validation and debugging I also know that the weapon reference isn't null.

To save my object to the database I use: getSqlMapClientTemplate().insert(statementMap.get("create"), object);

I'm using informix as my database and jboss as my application server.

Bit more output from my console:

14:33:12,796 ERROR [STDERR] org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [null]; error code [0];
--- The error occurred in sqlmaps/person.xml.
--- The error occurred while preparing the mapped statement for execution.
--- Check the Person.findById.
--- Check the parameter map.
--- Cause: com.ibatis.common.beans.ProbeException: Could not get property 'weapon' from null reference.  Cause: java.lang.NullPointerException; nested exception is com.ibatis.
common.jdbc.exception.NestedSQLException:
--- The error occurred in sqlmaps/person.xml.
--- The error occurred while preparing the mapped statement for execution.
--- Check the Person.findById.
--- Check the parameter map.
--- Cause: com.ibatis.common.beans.ProbeException: Could not get property 'weapon' from null reference.  Cause: java.lang.NullPointerException

Blockquote

A: 

This will be tough to track down - the SQL message info is in the first (very long) line of information:

[...] uncategorized SQLException for SQL []; SQL state [null]; error code [0];
--- The error occurred in sqlmaps/person.xml.

That is, essentially, no information - nominally, not even an error since 0 is the success code. However, I think something must have gone wrong.

Questions:

  • Was this working before?
  • Did you write the code?
  • Could blob types be involved?

I'm not sure there's anything much I can do with the answers; I think you should probably approach the support channels for Ibatis. I see that there are a number of questions about Ibatis on SO (nearly as many as there are about Informix, in fact), so you may get lucky.

If you end up having to debug, I'd want to look at the data relayed between client and the Informix data server (and at any log that Ibatis can keep about its SQL activity); there's a mechanism for doing in so in most of the C-based Informix clients, but I'm not sure about JDBC (it probably is there too, though). Contact me if need so be - see my profile. But I'm not an expert on Java or JDBC.

Jonathan Leffler
It's code that I wrote today, but I use the same generic class that I wrote for other objects and those work fine. And I'm not using any blobs, just booleans, varchar2 and numbers. And indeed, the error code 0 is confounding me. But since it referred to null I thought I might be missing something obvious. And I'm using SQuirrel to check my database. Personally I prefer hibernate, but I'm also more familiar with that.
jack