Questions tagged [nhibernate-cascade]

37 questions
1
vote
2 answers

Error in Cascade : a different object with the same identifier value was already associated with the session

I have a project by NHibernate implementation and using Lazy Loading. I have two class in this project : Person and Family. Relation between Those two is aggregation, is mean a Person has a list of Family. Mapping is :
Ehsan
  • 3,431
  • 8
  • 50
  • 70
1
vote
1 answer

Preventing a cascading update of a many-to-many relationship with NHibernate/FluentNHibernate,

I have a simple many-to-many relationship between the User class and the Place class. This relationship is represented by the User's "Neighbourhood" property public class User { public virtual IList Neighbourhood { get; set; } } The…
Øyvind
  • 1,600
  • 1
  • 14
  • 33
1
vote
1 answer

Nhibernate efficient cascade delete

On a delete context with nHibernate, when deleting a parent with child collection I would like to know why Nhibernate do a delete line by line for children (on child PK) DELETE FROM children where Id=1 DELETE FROM children where Id=2 ... DELETE…
Cyril035
  • 11
  • 4
1
vote
1 answer

nhibernate (or hibernate) Conditional cascading

I have a class User, that has a property Event, which has many Sessions. Basically, a user register to an event which have many sessions hours. The user can register for an event, but the sessions hours are purely informative. But when I write a…
1
vote
1 answer

Nhibernate Not Updating Cascade Relation On Win Server 2008

We are using NHibernate with Fluent mapping to build a WebForms application. In our model, we have a simple References relationship with Cascade.All() set. When we save the entity, NH behaves as expected and 1) saves the referenced entity, 2)…
jfneis
  • 2,139
  • 18
  • 31
1
vote
1 answer

Hibernate: cascade question

In hibernate, there are many information about set cascade to "all, delete" and so on, but I want to know the effect of set cascade to "none" now I have a class Parent, and it's child-class Child, class Parent{ List childs; ....} and in…
user421851
  • 777
  • 2
  • 6
  • 9
1
vote
1 answer

NHibernate ManyToMany Relationship Cascading AllDeleteOrphan StackOverflowException

I have two objects that have a ManyToMany relationship with one another through a mapping table. Though, when I try to save it, I get a stack overflow exception. The following is the code for the mappings: //EventMapping.cs HasManyToMany(x =>…
user358089
1
vote
1 answer

Hibernate cascade issue on delete record

I have issue with cascade a one to many relationship. One of my table contains a component, and the component is linked to another table which is my gallery (gallery have many kind of relationship with other tables.). Then the component is used in…
1
vote
2 answers

Delete Cascade is not working with NHibernate

I have a table Communication which has a reference to PersonCompany. In the mapping for PersonCompany i have defined a Cascade-Delete for this reference: this.HasMany(x => x.Communications) .AsSet() .KeyColumn("PersonCompanyId") …
BennoDual
  • 5,865
  • 15
  • 67
  • 153
1
vote
1 answer

fluent nhibernate one to many parent delete

We have 2 classes, Parent and Child The parent has no reference to the child, the child has the following defined in its fluent mapping: References(x => x.Parent, "Parent_id").Not.Nullable(); When the parent record is deleted, the following error…
1
vote
1 answer

Nhibernate mapping, cascade, inverse, update, insert?

I have a EmployeeMonth object which saves the calculated Bonus and Points earned by an employee. In the EmployeeMonth object there is a BonusMonth object. The BonusMonth object sets the intervals which the employee must reach every month to earn…
Ivan
  • 111
  • 1
  • 4
0
votes
1 answer

collection cascade type in nhibernate

I am using NHibernate 3.2, and using Mapping by Code. The test case is pretty straight-forward - I have a Store and a Product, linked by a many-to-many collection. The many-to-many collection in the StoreMap is mapped as follows: Set(x =>…
Karl Cassar
  • 6,043
  • 10
  • 47
  • 84
0
votes
1 answer

fluent nhibernate automapping one to many makes foreign key null

I am relatively new to NHberinate , and am using it as an alternative to EF cause it works nicely on Mono. All my entities are mapped with AutoMapping. The problem is I have a one to many relationship setup. One of Item class has an of…
0
votes
2 answers

NHibernate cascading problems

I have this mapping in one class: And this in the…
Groxx
  • 2,489
  • 1
  • 25
  • 32
0
votes
1 answer

Cascade value for property in partial class

I have a mapping and POCOs as below. The problem is that tbFNamesFeature is not being updated when this object is saved (whereas tblFeature is) I've tried different values for cascade, to no effect, so I'd have to say there's something I don't get.…
Al Lelopath
  • 6,448
  • 13
  • 82
  • 139