Howdy.
The log is filled with all sorts of select statements, but no insert statements or Hibernate exceptions. Also, the PostgreSQL sequence I use for generating keys is not advancing with each insert attempt. My mapping follows:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="School" table="tbl_schools">
<id name="id" type="int" column="school_id">
<generator class="sequence">
<param name="sequence">seq_school_id</param>
</generator>
</id>
<property name="created" type="date" insert="false"/>
<property name="name" type="string"/>
<property name="division" type="DivisionType"/>
<component name="address" class="Address" insert="true" update="true">
<property name="address1" type="string"/>
<property name="address2" type="string"/>
<property name="city" type="string"/>
<property name="state" type="StateType"/>
<property name="zip" type="string"/>
</component>
<set name="teams" inverse="true">
<key column="school_id"/>
<one-to-many class="Team"/>
</set>
<set name="contacts" inverse="true">
<key column="school_id"/>
<one-to-many class="Contact"/>
</set>
</class>
<query name="School.all.sorted"><![CDATA[
from School as school
order by school.name asc
]]></query>
</hibernate-mapping>
And the schema:
Code:
create sequence seq_school_id minvalue 100 maxvalue 999;
create table tbl_schools (
school_id int default nextval('seq_school_id') primary key,
created timestamp default now() not null,
name text not null,
division char(2) not null, -- 'cc' or 'hs'
address1 text not null,
address2 text,
city text not null,
state char(2) not null, -- e.g., 'CA'
zip char(10) not null
);
The application behaves like the transaction is never committed. Everything works when I use the SessionFactory directly -- without HibernateTemplate -- and manually commit my transaction or flush my session in the DAO.
Thanks again!
Matthew
P.S. Happy Thanksgiving!