This works but has unwanted implications. Inverse marks the collection as
being read-only, never reflecting its changes to the DB. When you have an
unidirectional association, you cannot add objects to the collection
anymore.
-Markus
2009/7/6 Cesar Sanz <[email protected]>

>  Hi, thanks for responding.
>
> I have included in the task--->schedule relationship an attribute
> [Inverse = true] everything goes fine, but, why this works? It is correct
> to include this
> attribute?
>
>
> ----- Original Message -----
>
>  *From:* Markus Zywitza <[email protected]>
> *To:* [email protected]
>   *Sent:* Friday, July 03, 2009 11:56 PM
> *Subject:* Re: AR cascading is Wrong (urgent!)
>
> ARDataBinder cannot know that the schedules are not in UI and will assume
> the user left them blank. Tell the binder by using the Exclude-property:
> [ARDataBind("task",..., Exclude="Schedules")]Task task
>
> -Markus
>
> 2009/7/3 Cesar Sanz <[email protected]>
>
>>  >Delete means that the ids are nulled when the schedule is removed from
>> the task or the task is deleted
>> So, if task is deleted, my schedules will still continue in the database
>> but with the foreign key (task_id) set to NULL?
>> Or will be deleted physically from database?
>>
>> >What you mean is perhaps AllDeleteOrphan, which also deletes orphaned
>> schedules.
>> What I want is, Do not update my schedules when task is updated.
>>
>> This project is been developed using monorail, I update a task from a
>> interface created for this purpose.
>> When I make the post I can see that task.Schedules = null, because I do
>> not utilize schedules in this UI.
>>
>> What can I do to solve this issue?
>>
>> ----- Original Message -----
>> *From:* Markus Zywitza <[email protected]>
>> *To:* [email protected]
>> *Sent:* Friday, July 03, 2009 9:38 AM
>> *Subject:* Re: AR cascading is Wrong (urgent!)
>>
>> Delete means that the ids are nulled when the schedule is removed from the
>> task or the task is deleted. What you mean is perhaps AllDeleteOrphan, which
>> also deletes orphaned schedules.
>>
>> And, when you are using a sessionscope, changes are updated ALWAYS when
>> the entity has been loaded in the same sessionscope. NH sessions have a
>> first-level-cache which performs dirty checking. Cascading defines behaviour
>> when a transient enitity gets persisted. This is the case when you call
>> Save() on an entity loaded before in another sessionscope or when you are
>> not using sessionscopes.
>> -Markus
>> 2009/7/3 [email protected] <[email protected]>
>>
>>>
>>> Hello,
>>>
>>> I have a sirious problem and don't know why it is happening.
>>>
>>> In my domain, I have mapped these relationships
>>>
>>> 1. Task HasMany Parameters
>>> 2. Task HasMany Schedules
>>>
>>> [Task]--------------------|< [Parameter] task_id is the foreign key
>>> [Task]--------------------|< [Schedule] task_id is the foreign key
>>>
>>> The first relationship is decored with the "Cascade =
>>> ManyRelationCascadeEnum.All" attribute
>>> The second relationship is decored with the "Cascade =
>>> ManyRelationCascadeEnum.Delete" attribute
>>>
>>> The problem is, that when I update the Task, all the Schedules get
>>> updated but with task_id in NULL, so the
>>> relationship is lost.
>>>
>>> Parameters are updated correctly.
>>>
>>> so
>>>
>>> Why is updating my Schedule when I update my Task if the cascade is
>>> set to Delete ??
>>>
>>> I thought it will only check my Schedule if Task was deleted
>>>
>>> Hope you can help me..
>>>
>>> Best regards and thanks in advance
>>>
>>>
>>>
>>>
>>
>>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" 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/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to