Hibernate Strange "ORA-01400: cannot insert NULL into" Error

1.9k Views Asked by At

there is a strange error ocurring to me. I'm working with Hibernate, I have mapped class called Widget, which has a Parameter class, but when I try to insert I get "ORA-01400: cannot insert NULL into..."

The mapping is properly done as:

<bag cascade="none" inverse="true" lazy="false" name="parameters" table="PARAMS" >
  <key column="WIDGET_ID" foreign-key="FK_PARAMS" not-null="true"/>
  <one-to-many class="Parameter"/>
</bag>

The wierd thing is that the not-null property is setted to "true" which forces to insert the ID value of the Widget Object.

Thanks in advance

1

There are 1 best solutions below

0
MikeOx On

Did you solved the problem? I think I had the same problem

ORA-01400: Cannot insert null into (TABLE.COLUMN) (Hibernate)

In my case I solved modifying Db, making foreign keys also primary keys