yes:
User mapping-File:
<class name="Spender" table="user" lazy="false" >
<id name="Key" column="user_id" type="Int32" >
<generator class="identity" />
</id>
<many-to-one
name="Title"
column="TITLE_ID"
class="Title"
not-found="ignore" />
</class>
Title mapping-File:
<class name="Title" table="TITLE">
<id name="Key" column="TITLE_ID" type="Int32" >
<generator class="identity" />
</id>
<property name="Name" type="String" >
<column name="DESCRIPTION" />
</property>
</class>
On 5 Dez., 00:21, Fabio Maulo <[email protected]> wrote:
> advise: switch your mind.
> When you are working with a tool as NHibernate you have to talk about
> entities, components (aka valueObjects), with properties and relations
> between classes.
> Can we see your classes and what you are doing to persist a User ?
>
> On Sat, Dec 4, 2010 at 6:32 PM, megaman
> <[email protected]>wrote:
>
>
>
> > Hi Jason,
> > glad to hear from you and thank you for the book, great tips
> > there ;-).
> > So the problem is why nhibernate try to update the title table. This
> > is an unidirectional many-one relationship.
> > I just wanna update the table user, i mean the entity user has a
> > reference to the entity title thats clear but in the db the table
> > user
> > has only the fk titleId.
> > Please i need you help and thanks again.
>
> > On 4 Dez., 21:46, Jason Dentler <[email protected]> wrote:
> > > The instructions in the exception message are clear. Title is transient,
> > and
> > > it is referenced in the graph of objects to be saved. You must explicitly
> > > save the title before flushing -or- use a cascade option that will do
> > this
> > > for you automatically.
>
> > > Thanks,
> > > Jason
>
> > > On Sat, Dec 4, 2010 at 10:56 AM, megaman <
> > [email protected]>wrote:
>
> > > > hi everyone,
> > > > i have already set the cascade to none but when i save the user , i
> > > > always get the exception object references an unsaved transient
> > > > instance - save the transient instance before flushing. maybe i have
> > > > to disable the auto dirty checking option? i am using the cbpt pattern
> > > > to deal with multiple sessions management.
> > > > Guys i need some help here.
> > > > Thanks in advance
>
> > > > On 4 Dez., 17:53, megaman <[email protected]> wrote:
> > > > > hi everyone,
>
> > > > > i implemented the tip of the book "nhibernate 3 cookbook"
> > > > > concerning "CbpT" pattern. In my modell i have an unidirectional
> > many-
> > > > > to-one association in the child. Here is the example:
>
> > > > > Title
> > > > > -----
> > > > > TitleId
> > > > > Description
>
> > > > > User
> > > > > -----
> > > > > UserId
> > > > > TitleId
>
> > > > > The class user has a reference to the object Title because i want to
> > > > > display in my gui the description. So user has a unidirectional
> > many-
> > > > > to-one association with the table Title.
>
> > > > > if i save the User say Session.save( User ) and ten call SaveAll()
> > > > > which flush the session, i get the exception "save transient entity
> > > > > Title" and dont get that because the cascade option is set to none.
>
> > > > > The definition of this association in the user mapping file is:
> > > > > many-to-one
> > > > > name="Title"
> > > > > column="TitleId"
> > > > > class="Title"
> > > > > cascade="none"
> > > > > not-found="ignore"
>
> > > > > Thanks in advance
>
> > > > --
> > > > 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.
>
> > --
> > 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]>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/nhusers?hl=en.
>
> --
> Fabio Maulo
--
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.