Edward Kenworthy
Sep 15th, 2004, 01:37 PM
Hi
I've gotten my spring application to work. Well mostly. I tried adding a new entity to the database (Hibernate) using getHibernateTemplate().saveOrUpdate(splash); but if I use that then it throws a SQL Exception that it can't find the row (well duh!).
So I changed it to getHibernateTemplate().save(splash); but now I get an exception that I'm trying to set a not null column to null which as far as I can tell is the id column which in the Hibernate mapping I set to:
<id name="id" type="int" column="id">
<generator class="native"/>
</id>
So shouldn't it automagically auto-generate it?
What am I doing wrong?
I've gotten my spring application to work. Well mostly. I tried adding a new entity to the database (Hibernate) using getHibernateTemplate().saveOrUpdate(splash); but if I use that then it throws a SQL Exception that it can't find the row (well duh!).
So I changed it to getHibernateTemplate().save(splash); but now I get an exception that I'm trying to set a not null column to null which as far as I can tell is the id column which in the Hibernate mapping I set to:
<id name="id" type="int" column="id">
<generator class="native"/>
</id>
So shouldn't it automagically auto-generate it?
What am I doing wrong?