When you created those tables, did you say "autonumber" on the id columns?
(From the describe table output in your previous email it seems like you
didn't.)

Telling hibernate that generator=native means that Hibernate will let the
database natively generate an id, which means you need to tell the database
to autonumber.

-Darius

On Mon, Aug 15, 2011 at 1:28 PM, Barbara Lerner <[email protected]>wrote:

> Using the debugger, I have determined that the error is:
>
> Field 'id' doesn't have a default value
>
> and that the SQL statement that is being attempted is:
>
> insert into draftforms_coded_answer (title, concept_id, other, text,
> coded_response_id) values ('CONGENITAL DISORDERS', 81, 0, '', 89)
>
> I believe the value for the id field is supposed to be generated, but I
> guess that it is not.  This is what is in the CodedAnswer.hbm.xml file:
>
> <id name="id" type="int" column="id" unsaved-value="0">
>  <generator class="native" />
>  </id>
>
> Thanks for your help,
>   Barbara
>
>  ------------------
>
> Barbara Lerner
> Associate Professor
> Computer Science Dept.
> Mt. Holyoke College
>
>
>
>
>
>
> ------------------------------
> Click here to 
> unsubscribe<[email protected]?body=SIGNOFF%20openmrs-devel-l>from 
> OpenMRS Developers' mailing list

_________________________________________

To unsubscribe from OpenMRS Developers' mailing list, send an e-mail to 
[email protected] with "SIGNOFF openmrs-devel-l" in the  body (not 
the subject) of your e-mail.

[mailto:[email protected]?body=SIGNOFF%20openmrs-devel-l]

Reply via email to