updatable=false
not-null=true

On <key> mapping

On Fri, 11 Mar 2016 at 4:44 AM Alexandre Lindolfo Vianna <
[email protected]> wrote:

> Hello guys!
>
> I have the following model...
>
> public class SLPiece : BaseEntityEditable
> {
>   public virtual ICollection<SLPieceOrder> SLPieceOrders { get; set; }
> }
> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
> assembly="PCT.Domain" namespace="Gerdau.PCT.Domain" >
>
>   <class name="SLPiece" table="P_SL_Piece" lazy="false"
> dynamic-update="true">
>
>     <id name="Id" column="Id_SL_Piece" type="Int64">
>       <generator
> class="Geraes.Library.Core.Domain.CustomTableHiLoGenerator,
> Library.Core.Domain" />
>     </id>
>     <set name="SLPieceOrders" generic="true" lazy="true"
> cascade="all-delete-orphan" fetch="select" inverse="true">
>       <key column="Id_SL_Piece" />
>       <one-to-many class="SLPieceOrder"/>
>     </set>
>   </class>
>
> </hibernate-mapping>
>
> public class SLPieceOrder : BaseEntity
> {
>   public virtual SLPiece SLPiece { get; set; }
>   public virtual SLPieceProduct SLPieceProduct { get; set; }
> }
> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
> assembly="PCT.Domain" namespace="Gerdau.PCT.Domain" >
>
>   <class name="SLPieceOrder" table="P_SL_Piece_Order" lazy="false"
> dynamic-update="true">
>
>     <id name="Id" column="Id_SL_Piece_Order" type="Int64">
>       <generator
> class="Geraes.Library.Core.Domain.CustomTableHiLoGenerator,
> Library.Core.Domain" />
>     </id>
>
>     <many-to-one name="SLPiece" column="Id_SL_Piece" class="SLPiece"
> cascade="none" fetch="join" not-null="true"/>
>
>     <many-to-one name="SLPieceProduct" class="SLPieceProduct"
> column="Id_SL_Piece_Product" lazy="proxy" cascade="all-delete-orphan"
> fetch="select" unique="true"/>
>   </class>
>
> </hibernate-mapping>
>
> public class SLPieceProduct : BaseEntityEditable
> {
>   public virtual String CustomerName { get; set; }
> }
> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
> assembly="PCT.Domain" namespace="Gerdau.PCT.Domain" >
>
>   <class name="SLPieceProduct" table="P_SL_Piece_Product" lazy="false"
> dynamic-update="true">
>
>     <id name="Id" column="Id_SL_Piece_Product" type="Int64">
>       <generator
> class="Geraes.Library.Core.Domain.CustomTableHiLoGenerator,
> Library.Core.Domain" />
>     </id>
>
>     <property name="CustomerName" column="Customer_Name" type="String"
> not-null="false" />
>
>   </class>
>
> </hibernate-mapping>
>
> when I try to delete the list with the command...
>
>   slPiece.SLPieceOrders.Clear();
>
> an Oracle error is generated...
>   UPDATE
>     P_SL_Piece_Order
>   SET
>     Id_SL_Piece_Product = :p0
>   WHERE
>     Id_SL_Piece_Order = :p1;
>     :p0 = NULL [Type: Int64 (0)], :p1 = 12325 [Type: Int64 (0)]
>
> ERROR [ADOExceptionReporter] ORA-24381: error(s) in array DML
>
> ORA-01407: cannot update
> ("PCT_PRD"."P_SL_PIECE_ORDER"."ID_SL_PIECE_PRODUCT") to NULL
>
> how can I solve this problem?
>
> Thank you very much in advance!
>
> --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/nhusers.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.

Reply via email to