Hi Roger,

that's what I experienced. The question now is if there is any other
way to correctly insert the detail class including the foreign key.
The reason I am asking is that

A) from a DDD point of view I should never adjust my domain model to
overcome persistence restrictions
and
B) stateless sessions are bloody fast. Of course it would be possible,
but not desirable, to switch to normal sessions.

The interface IStatelessSession does not seem to give one the
opportunity to solve the problem.
If there is no other way, I am thinking about extending the interface
with something like IStatelessSession.InsertMany(object entity, string
manyProperty). Do you think something like that would word? If yes,
would you consider including into the trunk?

Michael

On 29 Apr., 09:40, Roger Kratz <[email protected]> wrote:
> StatelessSession doesn't do cascade operations, AFAIK.
>
>
>
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf Of 
> mscheibler
> Sent: den 29 april 2009 07:57
> To: nhusers
> Subject: [nhusers] Re: IStatelessSession.Insert and uni-directional 
> one-to-many
>
> Again: anybody?
>
> On 28 Apr., 10:22, mscheibler <[email protected]>
> wrote:
> > Hi Fabio,
>
> > here are the mappings:
>
> >      <class name='TermsOfPaymentDetail'>
> >        <id name='_persistentId' column='Id' type='System.Int64'
> > access='field'>
> >          <generator class='hilo'>
> >            <param name='table'>UniqueId</param>
> >              <param name='column'>NextId</param>
> >              <param name='max_lo'>50</param>
> >            </generator>
> >          </id>
> >          <version name='_persistentLock' column='OptimisticLockId'
> > access='field' />
> >          <property name='Text' length='1024'>
> >            <column name='Text' />
> >          </property>
> >          <property name='PaymentTargetDays'>
> >            <column name='PaymentTargetDays' />
> >          </property>
> >          <property name='Discount'>
> >            <column name='Discount' />
> >          </property>
> >        </class>
> >        <class name='TermsOfPayment'>
> >          <id name='_persistentId' column='Id' type='System.Int64'
> > access='field'>
> >            <generator class='hilo'>
> >              <param name='table'>UniqueId</param>
> >              <param name='column'>NextId</param>
> >              <param name='max_lo'>50</param>
> >            </generator>
> >          </id>
> >          <version name='_persistentLock' column='OptimisticLockId'
> > access='field' />
> >          <list name='Details' cascade='all-delete-orphan'>
> >            <key column='TermsOfPayment' />
> >            <index column='Ordinal' type='System.Int32' />
> >            <one-to-many class='TermsOfPaymentDetail' />
> >          </list>
> >        </class>
>
> > Thanks for your help!
>
> > Michael
>
> > On 28 Apr., 07:08, Fabio Maulo <[email protected]> wrote:
>
> > > mappings?
>
> > > 2009/4/28 mscheibler <[email protected]>
>
> > > > Anybody?
>
> > > > On 27 Apr., 09:06, mscheibler <[email protected]>
> > > > wrote:
> > > > > Hello,
>
> > > > > I have two entities, A and B, with A having a collection of B but
> > > > > WITHOUT B having a reference to A.
> > > > > Of course the database foreign key column is in table B:
>
> > > > > class A {
> > > > >   ICollection<B> Bs { get; }
>
> > > > > }
>
> > > > > class B {
> > > > >   ... // does not have reference to A
>
> > > > > }
>
> > > > > table A {
> > > > > ID int,
> > > > > ...
>
> > > > > }
>
> > > > > table B {
> > > > > ID int,
> > > > > A_ID int,
> > > > > ...
>
> > > > > }
>
> > > > > Now I want to import a lot of As and Bs using
> > > > > IStatelessSession.Insert. The problem is I can only add Bs to A.Bs,
> > > > > but these are not inserted when I insert A. But when inserting B
> > > > > explicitly, A_ID always will have the value NULL.
>
> > > > > Is there a way to come around that problem?
>
> > > > > Thanks a lot!
>
> > > > > Michael
>
> > > --
> > > Fabio Maulo- Zitierten Text ausblenden -
>
> > > - Zitierten Text anzeigen -- Zitierten Text ausblenden -
>
> > - Zitierten Text anzeigen -- Zitierten Text ausblenden -
>
> - Zitierten Text anzeigen -
--~--~---------~--~----~------------~-------~--~----~
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