I am trying to save a class to my database that represents information that I received from a payment service.
It is a basic class with the following structure, methods excluded.
protected String textRequest;
protected String textResponse;
protected String clientIp;
protected Date whenOccured;
protected String merchantId;
protected Integer databaseId;
protected String status;
protected Integer result;
protected String authCode;
protected Integer providerId;
Note that databaseId is my primary key with auto_increment turned on (MySQL 4.1).
I have it mapped appropriately.
<hibernate-mapping package="com.devotion.payment.model">
<class name="Transaction" table="Transactions">
<cache usage="transactional"/>
<id name="databaseId" column="databaseId" type="int">
<generator class="native"/>
</id>
<property name="textRequest" column="textRequest" not-null="true"/>
<property name="textResponse" column="textResponse" not-null="true"/>
<property name="clientIp" column="clientIp" not-null="true"/>
<property name="whenOccured" column="whenOccured" type="date" not-null="true"/>
<property name="merchantId" column="merchantId" not-null="true"/>
<property name="status" column="status" not-null="true"/>
<property name="result" column="result" not-null="true"/>
<property name="authCode" column="authCode"/>
<property name="providerId" column="providerId" not-null="true"/>
</class>
</hibernate-mapping>
What is strange is that when I call save, Hibernate throws a java.lang.IllegalArgumentException; but the a row is created in the table.
Hibernate: /* insert com.devotion.payment.model.Transaction */ insert into Transactions (textRequest, textResponse, clientIp, whenOccured, merchantId, status, result, authCode, providerId) values (?, ?, ?, ?, ?, ?, ?, ?, ?)
Oct 31, 2005 5:47:24 PM org.hibernate.util.JDBCExceptionReporter logExceptions
WARNING: SQL Error: -1, SQLState: S1000
Oct 31, 2005 5:47:24 PM org.hibernate.util.JDBCExceptionReporter logExceptions
SEVERE: General error: java.lang.IllegalArgumentException
Query being executed when exception was thrown:
com.mysql.jdbc.ServerPreparedStatement[1] - /* insert com.devotion.payment.model.Transaction */ insert into Transactions (textRequest, textResponse, clientIp, whenOccured, merchantId, status, result, authCode, providerId) values ('', '', 'unknown', '2005-10-31', 'V63A0A942881', 'Declined', 12, '', 1)
org.hibernate.exception.GenericJDBCException: could not insert: [com.devotion.payment.model.Transaction]
at org.hibernate.exception.ErrorCodeConverter.handledNonSpecificException(ErrorCodeConverter.java:92)
Blah blah blah, nothing any more specific farther down the stack trace.
Does anyone else have experience with strange problems like this?
|