Hi all,
I'm quite new to spring & hibernate and I get this error I've already said in the title of this post when trying to persist an object. Here are the mappings of the objects. Thank you all. If you need something else, just ask for it and I will post. I think is enough with the mapping files but I have no idea.
Hibernate version: 3.0
Mapping documents:
SdmValoraci
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"xxxx://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="xx.xxxxx.xxxxxx.model.SdmValoraci" table="SDM_VALORACI">
<id
name="pkValoraci"
type="long"
column="PK_VALORACI"
length="22"
>
<generator class="sequence">
<param name="sequence">SEC_SDM_VALORACI</param>
</generator>
</id>
<property
name="vacerrado"
type="long"
column="VACERRADO"
not-null="true"
length="22"
/>
<property
name="vafechcrea"
type="date"
column="VAFECHCREA"
not-null="true"
length="7"
/>
<property
name="vafechreal"
type="date"
column="VAFECHREAL"
length="7"
/>
<property
name="vagrado"
type="string"
column="VAGRADO"
length="1"
/>
<property
name="vanivel"
type="string"
column="VANIVEL"
length="1"
/>
<property
name="vatipovalo"
type="string"
column="VATIPOVALO"
length="3"
/>
<!-- Associations -->
<!-- bi-directional one-to-one association to SdmEve -->
<one-to-one
name="sdmEve"
class="xx.xxxxx.xxxxxx.model.SdmEve"
lazy="proxy"
outer-join="auto"
cascade="all"
/>
<!-- bi-directional one-to-one association to SdmBvd -->
<one-to-one
name="sdmBvd"
class="xx.xxxxx.xxxxxx.model.SdmBvd"
lazy="proxy"
outer-join="auto"
/>
<!-- bi-directional one-to-one association to SdmInfoento -->
<one-to-one
name="sdmInfoento"
class="xx.xxxxx.xxxxxx.model.SdmInfoento"
lazy="proxy"
outer-join="auto"
/>
<!-- uni-directional many-to-one association to SdmDocugene -->
<many-to-one
name="sdmDocugene"
class="xx.xxxxx.xxxxxx.model.SdmDocugene"
lazy="proxy"
>
<column name="PK_DOCU" length="22"/>
</many-to-one>
<!-- uni-directional many-to-one association to SdxUsuario -->
<many-to-one
name="sdxUsuario"
class="xx.xxxxx.xxxxxx.model.SdxUsuario"
lazy="proxy"
>
<column name="PK_PERSONA" not-null="true" length="22"/>
</many-to-one>
<!-- bi-directional many-to-one association to SdmAsigsoli -->
<many-to-one
name="sdmAsigsoli"
class="xx.xxxxx.xxxxxx.model.SdmAsigsoli"
lazy="proxy"
>
<column name="PK_ASIGSOLI" not-null="true" length="22"/>
</many-to-one>
</class>
</hibernate-mapping>
SdmEveCode:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"xxxx://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="xx.xxxxx.xxxxxx.model.SdmEve" table="SDM_EVE">
<id
name="pkValoraci"
type="long"
column="PK_VALORACI"
length="22"
>
<generator class="foreign">
<param name="property">sdmValoraci</param>
</generator>
</id>
<property
name="evmessol"
type="long"
column="EVMESSOL"
not-null="true"
length="22"
/>
<property
name="evpesonaci"
type="long"
column="EVPESONACI"
length="22"
/>
<property
name="evpuntadap"
type="long"
column="EVPUNTADAP"
length="22"
/>
<property
name="evpuntdesa"
type="long"
column="EVPUNTDESA"
length="22"
/>
<property
name="evpuntfuvi"
type="long"
column="EVPUNTFUVI"
length="22"
/>
<property
name="evpuntmotr"
type="long"
column="EVPUNTMOTR"
length="22"
/>
<property
name="evpuntmovi"
type="long"
column="EVPUNTMOVI"
length="22"
/>
<property
name="evpuntsalu"
type="long"
column="EVPUNTSALU"
length="22"
/>
<!-- Associations -->
<!-- bi-directional one-to-one association to SdmValoraci -->
<one-to-one
name="sdmValoraci"
class="xx.xxxxx.xxxxxx.model.SdmValoraci"
lazy="proxy"
outer-join="auto"
/>
</class>
</hibernate-mapping>
Full stack trace of any exception that occurs:
org.springframework.orm.hibernate3.HibernateSystemException: attempted to assign id from null one-to-one property: sdmValoraci; nested exception is org.hibernate.id.IdentifierGenerationException: attempted to assign id from null one-to-one property: sdmValoraci
Caused by: org.hibernate.id.IdentifierGenerationException: attempted to assign id from null one-to-one property: sdmValoraci
Name and version of the database you are using:
Oracle 10g or so
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
13:13:47,366 DEBUG org.hibernate.event.def.AbstractSaveEventListener,main:112 - generated identifier: 23, using strategy: org.hibernate.id.SequenceGenerator
13:13:47,366 DEBUG org.hibernate.event.def.AbstractSaveEventListener,main:153 - saving [xx.xxxxx.xxxxxx.model.SdmValoraci#23]
13:13:47,428 DEBUG org.hibernate.engine.Cascade,main:115 - processing cascade ACTION_SAVE_UPDATE for: xx.xxxxx.xxxxxx.model.SdmValoraci
13:13:47,428 DEBUG org.hibernate.engine.Cascade,main:150 - done processing cascade ACTION_SAVE_UPDATE for: xx.xxxxx.xxxxxx.model.SdmValoraci
13:13:47,444 DEBUG org.hibernate.engine.IdentifierValue,main:104 - id unsaved-value: null
13:13:47,444 DEBUG org.hibernate.engine.Cascade,main:115 - processing cascade ACTION_SAVE_UPDATE for: xx.xxxxx.xxxxxx.model.SdmValoraci
13:13:47,444 DEBUG org.hibernate.engine.CascadingAction$5,main:216 - cascading to saveOrUpdate: xx.xxxxx.xxxxxx.model.SdmEve
13:13:47,444 DEBUG org.hibernate.event.def.AbstractSaveEventListener,main:514 - transient instance of: xx.xxxxx.xxxxxx.model.SdmEve