What exactly are you doing in your code?
Am schrieb mynkow <
myn...@gmail.com>:
> Hi
>
> I have an entity Culture with a child collection of value objects CultureResource. There is a concept of import/export for culture resources. When I do import a resource (key/value) is deleted and a resource is inserted (samekey/newvalue). As I know there is a specific order when a session is flushed:
>
> The SQL statements are issued in the following order:all entity insertions in the same order the corresponding objects were saved using Session.save()all entity updatesall collection deletionsall collection element deletions, updates and insertionsall collection insertionsall entity deletions in the same order the corresponding objects were deleted usingSession.delete()
>
> So, what happens is the insert is before the delete and I got error from the db for uniqueness. One of the solutions was to call session.Flush() right after the delete, but the Import/Export object does not know anything about persistence, so not an option.
>
>
> here is my mapping:
> Table("culture");
> Cache.ReadWrite();
>
> Id(c => c.Id, "culture_id");
> Map(c => c.CultureID, "lcid");
> Map(c => c.ShortName, "abbr");
> Map(c => c.FullName, "name");
> HasManyLocalizationResource>(Reveal.MemberCulture>("_resourcesCollection"))
> .Access.CamelCaseField()
> .Cascade.AllDeleteOrphan()
> .Inverse()
> .Not.LazyLoad()
> .Fetch.Join()
> .Cache.ReadWrite().Region("resources");
> Any ideas how to force delete before insert?
> Any other suggestions?
>
>
> Best regards
>
>
>
>
>
> --
>
> You received this message because you are subscribed to the Google Groups "nhusers" group.
>
> To view this discussion on the web visit
https://groups.google.com/d/msg/nhusers/-/wO4TC513naUJ.
>
> To post to this group, send email to
nhu...@googlegroups.com.
>
> To unsubscribe from this group, send email to
nhusers+u...@googlegroups.com.
>
>
> For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.
>
>
>
>