This question is locked. New answers and comments are not allowed.
I been looking through the documentation andnorthwind example, but can't seem to find an answer. I used both the HIGHLOW method and AUTOINC without success.
I have a form in which i have some textfields and a gridview. The textfields represent data for an order, and the gridview rows represent OrderLines (details about what products are being bought).
When the user clicks save, i'm creating a new order object, and add new orderline objects to a list in the order object, based on the values the user entered. After all objects are created and nested, i try to add the root order object to the database. When the transaction is committed i get an error saying the order_id field for the orderlines is null. What do i need to do in order to get it to be the id of the root object?
Here's my reverse mapping:
I have a form in which i have some textfields and a gridview. The textfields represent data for an order, and the gridview rows represent OrderLines (details about what products are being bought).
When the user clicks save, i'm creating a new order object, and add new orderline objects to a list in the order object, based on the values the user entered. After all objects are created and nested, i try to add the root order object to the database. When the transaction is committed i get an error saying the order_id field for the orderlines is null. What do i need to do in order to get it to be the id of the root object?
Here's my reverse mapping:
<table name="'OrderLines'" type="1" locked="False"> |
<column name="id" isPk="True" isAutoInc="False" adoType="4" sqlType="int" length="0" isNull="False" /> |
<column name="order_id" isPk="False" isAutoInc="False" adoType="4" sqlType="int" length="0" isNull="False" /> |
<column name="product_id" isPk="False" isAutoInc="False" adoType="4" sqlType="int" length="0" isNull="True" /> |
<column name="unit_count" isPk="False" isAutoInc="False" adoType="4" sqlType="int" length="0" isNull="True" /> |
<column name="unit_price" isPk="False" isAutoInc="False" adoType="3" sqlType="decimal" length="18" scale="4" isNull="True" /> |
<constraint name="FK_OrderLines_Orders" table="'OrderLines'" dest="'Orders'"> |
<column name="order_id" /> |
</constraint> |
<constraint name="FK_OrderLines_Products" table="'OrderLines'" dest="'Products'"> |
<column name="product_id" /> |
</constraint> |
<class name="OrderLine" namespace="TelerikUI.Domain" check="-1" generated="True"> |
<field name="_id" type="1" isPK="True" column="id" valueType="System.Int32" /> |
<field name="_orderId" type="1" isPK="False" column="order_id" valueType="System.Int32" /> |
<field name="_productId" type="1" isPK="False" column="product_id" valueType="System.Nullable`1[[System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]" /> |
<field name="_unitCount" type="1" isPK="False" column="unit_count" valueType="System.Nullable`1[[System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]" /> |
<field name="_unitPrice" type="1" isPK="False" column="unit_price" valueType="System.Nullable`1[[System.Decimal, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]" /> |
<field name="_order" type="2" isPK="False" reference="'Orders'"> |
<mapping field="Order._id" column="order_id" /> |
<inverse name="_orderLines" /> |
</field> |
<field name="_product" type="2" isPK="False" reference="'Products'"> |
<mapping field="Product._id" column="product_id" /> |
</field> |
</class> |
</table> |
So currently i'm trying to use the highlow key generator, but having auto increment didn't help.
Any ideas or basic tutorials on how to insert nested data? I couldn't find one. The documentation is a bit badly organized.