Menu

Delete

2004-10-18
2013-03-07
  • Nobody/Anonymous

    Hi,
    I have this code:
    <class name="PedidoVenta" table="pedidoventa" database="erp" namespace="Ventas">
            <attribute name="CodigoPedidoVenta" column="CodigoPedidoVenta" find="true" key="primary" />
            <attribute name="CodigoCliente" column="CodigoCliente" />       
            <attribute name="FormaPago"></attribute>
            <attribute name="CodigoFormaPago" column="CodigoFormaPago"></attribute>
            <attribute name="FormaEnvio"></attribute>
            <attribute name="CodigoFormaEnvio" column="CodigoFormaEnvio"></attribute>
            <attribute name="TipoEstado"></attribute>
            <attribute name="CodigoTipoEstado" column="CodigoTipoEstado"></attribute>
            <attribute name="TipoPorte"></attribute>
            <attribute name="CodigoTipoPorte" column="CodigoTipoPorte"></attribute>
            <attribute name="Almacen"></attribute>
            <attribute name="CodigoAlmacen" column="CodigoAlmacen"></attribute>
            <attribute name="Numero" column="NumeroPedidoVenta"/>
            <attribute name="Fecha" column="Fecha"/>
            <attribute name="Descuento" column="Descuento"/>
            <attribute name="GastosVarios" column="GastosVarios"/>
            <attribute name="Bruto" column="Bruto"/>
            <attribute name="Base" column="Base"/>
            <attribute name="Iva" column="Iva"/>
            <attribute name="Total" column="Total"/>       
            <attribute name="Porte" column="Porte"/>               
            <attribute name="DetallePedidoVenta"/>               
            <attribute name="AlbaranesVenta"/>
            <attribute name="CreatedDate" column="CreatedDate" timestamp="true" />
            <attribute name="ModifiedDate" column="ModifiedDate" timestamp="true" />
        </class>
    <class name="DetallePedidoVenta" table="DetallePedidoVenta" database="erp" namespace="Ventas">
            <attribute name="CodigoDetallePedidoVenta" column="CodigoDetallePedidoVenta" find="true" key="primary" />
            <attribute name="Cantidad" column="Cantidad" />
            <attribute name="Precio" column="Precio" />
            <attribute name="Descuento" colummn="Descuento" />       
            <attribute name="Importe" column="Importe" />
            <attribute name="CodigoAlmacen" column="CodigoAlmacen"></attribute>
            <attribute name="CodigoMaterial" column="CodigoMaterial"></attribute>                               
            <attribute name="AlmacenMaterial"/>
            <attribute name="PedidoVenta"/>
            <attribute name="CodigoPedidoVenta" column="CodigoPedidoVenta" />
            <attribute name="CreatedDate" column="CreatedDate" timestamp="true" />
            <attribute name="ModifiedDate" column="ModifiedDate" timestamp="true" />
        </class>
        <association fromClass="Ventas.PedidoVenta" toClass="Ventas.DetallePedidoVenta" cardinality="oneToMany" target="DetallePedidoVenta"
            retrieveAutomatic="true" deleteAutomatic="true" saveAutomatic="false" inverse="false">           
            <entry fromAttribute="CodigoPedidoVenta" toAttribute="CodigoPedidoVenta" />       
        </association>   
    I am delete a DetallePedidoVenta and i am saving PedidoVenta, but deleteAutomatic doesn't .

    Saludos

    Victor (Madrid - Spain)

     
    • Richard Banks

      Richard Banks - 2004-10-18

      Hi Victor,

      Thanks for the report.  I'll look into it.

       
    • Richard Banks

      Richard Banks - 2004-10-19

      Hi Victor,

      I've done some testing here and I can't duplicate the problem.

      I can delete an object and delete all of it's children, and I can save an object and save all it's children as well. (There was a problem in the CVS version of save that I've fixed).

      I noticed that you haven't got saveAutomatic turned on in the association.  Is that desired behaviour?

      - Richard.

       
    • Nobody/Anonymous

      hi,
      I have a question:
      I have two objects: A OneToMany B.
      if object A has six asociate with object B. If I am deleting three object B of de A and update A, the 3 objects deleted is deleted of the database or not.

      Saludos

      Victor (Madrid - spain)

       
    • Richard Banks

      Richard Banks - 2004-10-20

      When you delete the B objects from A, are you calling B.Delete() and then removing them from the collection?
      Or are you just removing them from the collection and not specifically calling delete?

      The second method will still leave the B objects in the database (they may be referenced by other objects).

      The first method should work properly.

      - Richard.

       
    • Nobody/Anonymous

      I am deleting objects B from collection and after execute A.save.  the objects B deleted of the collection is deleted of database

      Saludos

      Victor (Madrid - Spain)

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.