I'm running into issues inserting an entity into PostgreSQL. I have a column is_deleted that is a not null boolean type. When I try to perform an insert I recieve the following error in my log "ExecInsert: Fail to add null value in not null attribute is_deleted". The value of the is_deleted or rather isDeleted property in my class is set to false and the log even tells me the value it is trying to insert for that column is false but I still get the error.
Log snippets:
2004-05-05 10:26:50,011 DEBUG net.sf.hibernate.impl.Printer - com.activerain.model.UserAccount{password=null, userID=4, emailAddress=test@test.com, auditInfo=AuditInfo{deleteDate=null, insertDate=05 May 2004 10:26:50, updateDate=05 May 2004 10:26:50, isDeleted=false}, userRoles=null, recieveHtmlEmail=false}
2004-05-05 10:26:50,011 DEBUG net.sf.hibernate.impl.SessionImpl - executing flush
2004-05-05 10:26:50,011 DEBUG net.sf.hibernate.persister.EntityPersister - Inserting entity: [com.activerain.model.UserAccount#4]
2004-05-05 10:26:50,011 DEBUG net.sf.hibernate.impl.BatcherImpl - about to open: 0 open PreparedStatements, 0 open ResultSets
2004-05-05 10:26:50,011 DEBUG net.sf.hibernate.SQL - insert into user_account (email_address, password, receive_html_email, is_deleted, insert_date, update_date, delete_date, user_id) values (?, ?, ?, ?, ?, ?, ?, ?)
2004-05-05 10:26:50,014 WARN net.sf.hibernate.util.JDBCExceptionReporter - SQL Error: 0, SQLState: null
2004-05-05 10:26:50,014 ERROR net.sf.hibernate.util.JDBCExceptionReporter - Batch entry 0 insert into user_account (email_address, password, receive_html_email, is_deleted, insert_date, update_date, delete_date, user_id) values ( was aborted. Call getNextException() to see the cause.
2004-05-05 10:26:50,014 WARN net.sf.hibernate.util.JDBCExceptionReporter - SQL Error: 0, SQLState: null
2004-05-05 10:26:50,014 ERROR net.sf.hibernate.util.JDBCExceptionReporter - ERROR: ExecInsert: Fail to add null value in not null attribute is_deleted
Mapping file:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping package="com.activerain.model" default-cascade="save-update">
<class name="UserAccount" table="user_account">
<id name="userID" column="user_id" type="long">
<generator class="sequence">
<param name="sequence">user_sequence</param>
</generator>
</id>
<property name="emailAddress" column="email_address" type="string"/>
<property name="password" column="password" type="string"/>
<property name="recieveHtmlEmail" column="receive_html_email" type="boolean"/>
<set name="userRoles" order-by="user_role_id asc">
<key column="user_id"/>
<one-to-many class="UserRole"/>
</set>
<many-to-one name="contactInfo" class="ContactInfo" column="contact_info_id" outer-join="true"/>
<component name="auditInfo">
<property name="isDeleted" column="is_deleted" type="true_false"/>
<property name="insertDate" column="insert_date" type="timestamp"/>
<property name="updateDate" column="update_date" type="timestamp"/>
<property name="deleteDate" column="delete_date" type="timestamp"/>
</component>
</class>
</hibernate-mapping>
|