Copying answer to Sravan, I didn't see he replied to me privately ---------- Forwarded message ---------- Date: Wed, Feb 17, 2010 at 21:41 To: sravan <[email protected]>
Well, that's the problem with sql-insert "If it hurts when you do that, stop doing it" Go with the intermediate entity then. Diego On Wed, Feb 17, 2010 at 20:49, sravan <[email protected]>wrote: > Thank you very much for your reply. > > I tried using the Custom sql-insert , the problem with that is how do > we refer > to "CreateUserID" vaule in the sql-insert statement. > <sql-insert callable="false" check="none"> > insert into ModelMemo(ModelID ,MemoID,create_user_Id, > create_timestamp) values (?,?, ("How to get this"),getdate()) > </sql-insert> > > Thank you very much for your help. > > Sravan > > > > On Feb 17, 3:26 pm, Diego Mijelshon <[email protected]> wrote: > > Custom sql-insert might work. However, it's probably better to create the > > ModelMemo entity and project it in your model. > > Example: > > > > class Model > > { > > public IEnumerable<Memo> Memos > > { > > get{ return ModelMemos.Select(mm => mm.Model); } > > } > > > > public void Add(Memo memo) > > { > > ModelMemos.Add(new ModelMemo { Model=this, Memo=memo }); > > } > > > > protected IList<ModelMemo> ModelMemos {get;set;} > > > > } > > > > Diego > > > > On Wed, Feb 17, 2010 at 14:26, sravan <[email protected] > >wrote: > > > > > > > > > I have the following three tables. > > > ModelMemo is a joiner table > > > > > Model > > > ModelId > > > Name > > > CreateUserId > > > CreateTimestamp > > > LastupdatedUserId > > > LastupdatedTimestamp > > > > > Memo > > > MemoId > > > Name > > > CreateUserId > > > CreateTimestamp > > > LastupdatedUserId > > > LastupdatedTimestamp > > > > > ModelMemo > > > Id > > > ModelId > > > MemoId > > > CreateUserId > > > CreateTimestamp > > > LastupdatedUserId > > > LastupdatedTimestamp > > > > > The following is the class structure > > > > > class Model > > > { > > > IList<Memo> Memos{get ;set} > > > > > } > > > > > class Memo > > > { > > > IList<Model> Models{get ;set} > > > > > } > > > > > I am not having the entity for the joiner table.(ModelMemo) > > > > > when i add or update Models or Memos i want the system columns in the > > > ModelMemo table to be updated. > > > > > Is there is any other way except creating a separate entity for the > > > joiner table using two one-to-many' s instead of many-to-many. > > > > > Can we do anywork arounds using the event listeners or > > > > > using using custom sql-insert, sql-update. > > > > > I personally do not like creating a separate entity for joiner table > > > (When the joiner table just has the additional system columns ). > > > > > Thanks, > > > Sravan > > > > > -- > > > 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]<nhusers%[email protected]> > <nhusers%[email protected]<nhusers%[email protected]> > > > > > . > > > For more options, visit this group at > > >http://groups.google.com/group/nhusers?hl=en.- Hide quoted text - > > > > - Show quoted text - > -- 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.
