Announcement Announcement Module
Collapse
No announcement yet.
Mapping hibernate error which cascade property (oneToMany) Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Mapping hibernate error which cascade property (oneToMany)

    I would like create a new object (Code) which has a relation (one to many) with another class (Traduction).

    I have configurate my hbm.xml like

    <class name="eu.cec.oib.i18n.domain.Code" table="T_I18N_CODES">
    <id column="CODEID" type="long" name="id">
    <generator class="sequence">
    <param name="sequence">I18N_CODES_SEQ</param>
    </generator>
    </id>
    <property column="CODECD" length="50" name="code" not-null="true" type="string"/>
    <map name="traductions" table="T_I18N_CODES_TRAD" lazy="false" cascade="all">
    <key column="CODEID" foreign-key="CODEID"/>
    <index column="CODELG" type="string" length="2" />
    <one-to-many class="eu.cec.oib.i18n.domain.Traduction"/>
    </map>

    </class>

    When I create a new object Code (but his identifier has created by a oracle sequence), i cann't fill in the table T_I18N_CODES_TRAD.
    I have an exception "DataAccessFailure", and you can see the error:

    org.springframework.orm.hibernate.HibernateSystemE xception: not-null property references a null or transient value: eu.cec.oib.i18n.
    domain.Traduction.codeId; nested exception is net.sf.hibernate.PropertyValueException: not-null property references a null or transi
    ent value: eu.cec.oib.i18n.domain.Traduction.codeId
    net.sf.hibernate.PropertyValueException: not-null property references a null or transient value: eu.cec.oib.i18n.domain.Traduction.c
    odeId


    The table T_I18N_CODES_TRAD has a foreign key which is the primary key of T_I18N_CODES.

    Can you me help to resolve my problem.

    Thanks.

    Susu
Working...
X