Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: 2.1.8
Mapping documents:
<class name="es.cyii.formuWeb.model.Answer" table="ANSWERS">
...
<one-to-one name="Contact" class="es.cyii.formuWeb.model.Contact"
cascade="save-update"/>
</class>
<class name="es.cyii.formuWeb.model.Contact" table="CONTACTS">
<id name="IdContact" type="integer">
<column name="IDCONTACT"/>
<generator class="sequence">
<param name="sequence">SEQ_CONTACTS</param>
</generator>
</id>
</class>
Code between sessionFactory.openSession() and session.close():
result = (Integer)getHibernateTemplate().save(answer);
Full stack trace of any exception that occurs:
(HibernateTemplate): data integrity violated by SQL 'null'; nested exception is java.sql.BatchUpdateException: ORA-01400: cannot insert NULL into ("FORMUWEB"."ANSWERS"."IDCONTACT")
Name and version of the database you are using:
Oracle 8.1.6
The generated SQL (show_sql=true):
Hibernate: insert into ANSWERS (ANSWER, ANSWER_DATE, IDANSWER) values (?, ?, ?)
Hi,
I'm developing an app with Hibernate 2.1.8 and I have a problem with a one-to-one relation. As you can see hibernate doesn't generate in the sql the field of the relation. I have tried with the code I have attached and other combinations in the relation mapping, and I have looked for an idea in HiA without results.
I would appreciate any help?
Thanks
Rodolfo