I completely agree with you.

However the company I am working with currently has a more data driven
approach where that database is god and everything should be written
to conform the database.  Not the otherway around.  Thus they think
certain tables are more important than others and these tables should
be versioned.

Will try to handle this in my repository to manually delete the 'non
versionable' collections!

On 11 sep, 10:57, "Ken Egozi" <[EMAIL PROTECTED]> wrote:
> well I think that for the sake of versioning, you should soft-delete the
> cascaded lines also (and have the DBA'd trigger populate the history table
> using the linked orderlines or whatever). that's for history data etc.
> so, a whole aggregate should either be versionable or not
>
> On Thu, Sep 11, 2008 at 11:36 AM, Patrick De Boeck <[EMAIL PROTECTED]>wrote:
>
>
>
>
>
> > Is it possible to know during the update or save listener that
> > attached object it belongs to and then check if it is Versionable
> > (thus stopping it here from re-inserting)
>
> > On 10 sep, 23:41, Patrick De Boeck <[EMAIL PROTECTED]> wrote:
> > > yep.  Can't find any refernce on this.
>
> > > I was thinking about a generic way of removing all objects from my
> > > versionable object and thus avoiding problems but I cannot find a
> > > clean way to achieve that at the moment!
>
> > > On 10 sep, 22:54, "Will Shaver" <[EMAIL PROTECTED]> wrote:
>
> > > > So you only want some of your entities to be marked as deleted and you
> > want
> > > > other entities to actually delete?
>
> > > > On Wed, Sep 10, 2008 at 1:36 PM, Patrick De Boeck <[EMAIL PROTECTED]
> > >wrote:
>
> > > > > I have seen that example, but if I take that case as an example then
> > > > > my order would be softdeletable, but the orderline would not!
>
> > > > > Thus when I remove my order that will be set to "IsDeleted = true",
> > > > > while my orderlines would actually be deleted immediately!
>
> > > > > This leads to resaving a deleted orderline !
>
> > > > > On 10 sep, 18:37, "Will Shaver" <[EMAIL PROTECTED]> wrote:
>
> >http://blogs.hibernatingrhinos.com/nhibernate/archive/2008/04/08/soft...
>
> > > > > > There is also some code in the NHibernate Contrib project under
> > > > > > NHibernate.Burrow.Appblock.SoftDelete that you can review or use.
>
> > > > > >  -Will
>
> > > > > > On Wed, Sep 10, 2008 at 4:06 AM, Patrick De Boeck <
> > [EMAIL PROTECTED]
> > > > > >wrote:
>
> > > > > > > Hi All,
>
> > > > > > > I have the following situation:  A domain model which has various
> > > > > > > classes that all map to one or more tables in a DB2 database.
> >  For
> > > > > > > keeping track of versioning our dba guys have written a trigger
> > that
> > > > > > > will copy the entire table record into a seperate 'history'
> > version
> > > > > > > table.
>
> > > > > > > No worries untill they figured out that with this approach it
> > would be
> > > > > > > impossible to track who actually deleted an item.  So they went a
> > step
> > > > > > > further and made deletes forbidden.  Now we would have to update
> > the
> > > > > > > record and set the a field to '+DELETE+'.  A trigger will then
> > run
> > > > > > > afterwards and copy the 'deleted' version to the history and then
> > > > > > > fysically delete the row.
>
> > > > > > > So far the intro.  I have made an interface IVersionable (because
> > not
> > > > > > > all domain objects require this approach) and have written a
> > > > > > > IVersionableDeleteEventListener that will do the following:
>
> > > > > > > if (entity is IVersionable)
> > > > > > > {
> > > > > > >       IVersionable versionable = (IVersionable)entity;
> > > > > > >       versionable.CreatedBy = "+DELETE+";
> > > > > > >       versionable.LastModification = DateTime.Now;
> > > > > > >       versionable.LastModifiedBy =
> > > > > > > UserContextHelper.GetUserPrincipal();
>
> > > > > > >       CascadeBeforeDelete(session, persister, entity,
> > entityEntry,
> > > > > > > transientEntities);
> > > > > > >       CascadeAfterDelete(session, persister, entity,
> > > > > > > transientEntities);
> > > > > > > }
> > > > > > > else
> > > > > > > {
> > > > > > >       base.DeleteEntity(session, entity, entityEntry,
> > > > > > > isCascadeDeleteEnabled,
> > > > > > >                                  persister, transientEntities);
> > > > > > > }
>
> > > > > > > This now conflicts with my cascading rules I have set for this
> > > > > > > object.  I receive the following error: "deleted object would be
> > re-
> > > > > > > saved by cascade"
>
> > > > > > > The problem lies in the fact that A has a collection of B.  A is
> > > > > > > Versionable while B is not.  Thus B should be deleted and A
> > should be
> > > > > > > marked for deletion.  The cascading options set on A try the
> > re-save B
> > > > > > > which results in the above error.
>
> > > > > > > Does anyone have had the same problem and how have you then
> > solved
> > > > > > > this?
>
> --
> Ken 
> Egozi.http://www.kenegozi.com/bloghttp://www.musicglue.comhttp://www.castleproject.orghttp://www.gotfriends.co.il
--~--~---------~--~----~------------~-------~--~----~
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