Hello,

I got an exception error. I'm thinking this is for the cascade.

System.TypeInitializationException : The type initializer for
'Bogetz.Elephant.Model.NHibernateHelper' threw an exception.
  ----> NHibernate.MappingException : Could not configure datastore from
input stream Bogetz.Elephant.Model.Mappings.TruckLoad.hbm.xml
  ----> System.Xml.XmlException : '"' is an unexpected token. The expected
token is '='. Line 18, position 28. -
d:\bogetz\projects\elephant\trunk\src\Bogetz.Elephant\Model\NHibernateHelper.cs:21

I think I got a cascade in the

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
    namespace="Bogetz.Elephant.Model" assembly="elephant">

    <class name="PurchaseOrder" table="purchase_orders">
        <id name="Id">
            <generator class="native"/>
        </id>
        <property name="Date"/>
        <many-to-one name="Vendor" class="Vendor" column="VendorId"/>
        <bag name="Items" cascade="all">
            <key column="POId"/>
            <one-to-many class="PurchaseOrderItem" cascade="all"/>
        </bag>
        <property name="PreparedBy"/>
        <property name="ApprovedBy"/>
        <property name="ReferenceNo"/>
    </class>

    <class name="PurchaseOrderItem" table="purchase_order_items">
        <id name="Id">
            <generator class="native"/>
        </id>
        <many-to-one name="Order" class="PurchaseOrder" column="POId"/>
        <many-to-one name="Item" class="Item" column="ItemId"/>
        <property name="UnitPrice"/>
        <property name="Quantity"/>
        <property name="Amount"/>
    </class>

</hibernate-mapping>

Removed the yellow part and works fine by parsing the xml though the still
exists in the

System.TypeInitializationException : The type initializer for
'Bogetz.Elephant.Model.NHibernateHelper' threw an exception.
  ----> NHibernate.MappingException : Could not configure datastore from
input stream Bogetz.Elephant.Model.Mappings.TruckLoad.hbm.xml
  ----> System.Xml.XmlException : '"' is an unexpected token. The expected
token is '='. Line 18, position 28. -
d:\bogetz\projects\elephant\trunk\src\Bogetz.Elephant\Model\NHibernateHelper.cs:21

Thanks!

On Tue, Jul 28, 2009 at 3:11 PM, Nexus <[email protected]> wrote:

>
> Try this
>
> <bag name="Items" >
>            <key column="POId"/>
>            <one-to-many class="PurchaseOrderItem" cascase="all"/>
>        </bag>
>
> kind regards
>
> On 28 jul, 03:26, Ian Escarro <[email protected]> wrote:
> > I have an error in deleting a master/detail relationship. I have a
> > PurchaseOrder class and a PurchaseOrderItem class. These are the mapping.
> >
> > <?xml version="1.0" encoding="utf-8" ?>
> > <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
> >     namespace="Bogetz.Elephant.Model" assembly="elephant">
> >
> >     <class name="PurchaseOrder" table="purchase_orders">
> >         <id name="Id">
> >             <generator class="native"/>
> >         </id>
> >         <property name="Date"/>
> >         <many-to-one name="Vendor" class="Vendor" column="VendorId"/>
> >         <bag name="Items" cascade="all">
> >             <key column="POId"/>
> >             <one-to-many class="PurchaseOrderItem"/>
> >         </bag>
> >         <property name="PreparedBy"/>
> >         <property name="ApprovedBy"/>
> >         <property name="ReferenceNo"/>
> >     </class>
> >
> >     <class name="PurchaseOrderItem" table="purchase_order_items">
> >         <id name="Id">
> >             <generator class="native"/>
> >         </id>
> >         <many-to-one name="Order" class="PurchaseOrder" column="POId"/>
> >         <many-to-one name="Item" class="Item" column="ItemId"/>
> >         <property name="UnitPrice"/>
> >         <property name="Quantity"/>
> >         <property name="Amount"/>
> >     </class>
> >
> > </hibernate-mapping>
> >
> > and when I issue someSession.Delete(PurchaseOrder) it throws the
> exception
> > above. I need help in finding the things I missed. Thanks in advance.
> >
> > ---
> > Ian
> >
>


-- 
Ian Escarro

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to