I've been strugling to get this problem out of my life for a few days now, basically i'm developing a form which edits an Entity object, this Entity object (among other things) has a ICollection<EntityReactionType> property. This property has an X amount of values currently set and i want to add some values.
The form does this perfectly, it creates a EntityReactionType from a ReactionType by setting the associated Entity and ReactionType properties in the EntityReactionType and also adds the newly created object to the ICollection<EntityReactionType> property. When i add one new EntityReactionType and try to save i recieve an error that NHibernate is trying to insert NULL values in both the Entiteit_ID and ReactieType_ID fields. When i look at the object associated with the Entity object the ID values are filled so i'm at a loss why it's trying to save NULL values. Something seems very very wrong, possibly in my mappings i get's even stranger when i add TWO new objects to the collection, all the properties get set the right values and i try to save, instead of giving me an error that it's trying to save NULL values i get an exception from NHibernate itself namely: Non-static method requires a target., NHibernate.Properties.BasicPropertyAccessor.BasicGetter.Get(Object target) (i ran into this problem before i foudn the NULL value one hence the following discussion: http://groups.google.com/group/nhusers/browse_thread/thread/b4e7178befbc9280 i feel the NULL values thing might be easier to solve and possibly even have the same cause as the Non Static method error) I'd very much like to save my changes to the database to start with, when that's tackled if the other problem is still here ill focus all my attention on that (which i've done for a few days already with absolutely NO progress to show for it >.<) Relative mapping file(s): <?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="DirectPay.Backoffice.Entities" namespace="DirectPay.Backoffice.Entities"> <class name="EntityReactionType" table="tbl_Entiteit_Reactie_Type" batch-size="50"> <composite-id unsaved-value="undefined"> <key-many-to-one name="Entity" column="Entiteit_ID" class="Entity"/ > <key-many-to-one name="ReactionType" column="Reactie_Type_ID" class="ReactionType"/> </composite-id> <property name="Text" column="Omschrijving"/> <set name="PossibleResponses" table="tbl_Entiteit_Response_Reactie_Type" batch-size="50"> <key> <column name="Bron_Entiteit_ID" sql-type="int"/> <column name="Bron_Reactie_Type_ID" sql-type="int"/> </key> <many-to-many class="EntityReactionType"> <column name="Response_Entiteit_ID"/> <column name="Response_Reactie_Type_ID"/> </many-to-many> </set> </class> </hibernate-mapping> And within the Entity Mapping (which is pretty large so i'll only post a snipped) <set name="EntityReactionTypes" cascade="all-delete-orphan" inverse="true"> <key column="Entiteit_ID"></key> <one-to-many class="EntityReactionType"/> </set> Basically it's a many-to-many association with the only thing different beeing that there is also a Text property which changes based on the relationship. Changing it into two one-to-many associations. Really hope someone can help me out this time. Greetings, F.B. ten Kate -- 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.
