Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
1.2 Beta
Mapping documents:
Multiple persistent classes mapped together with ISet (C#) and the set-tag in the mapping xml files over multiple relational database tables with foreign key constraints.
Code between sessionFactory.openSession() and session.close():
Getting a unique user.
Any exception that occurs:
No row with the given identifier exists: 28f24a04-35b5-4e11-a3de-64dfdb791c18, of class: Profile
Profile is a property of the User class.
Anyhow... I want to know how to effectively deal with databases where you got multiple objects in 'table one', each row representing one object, but you also got multiple other tables representing other functionality and/or properties for the objects in table one.
Now... Not all tables' foreign key columns will be populated with the key of the object in 'table one', because I choose not to implement all the extensions/properties to the objects in table one. This means that if NHibernate is asked to delete an object from table one, like such:
Code:
orpSession.Delete(tableOneObject);
, it cascades and NHibernate starts looking for the object's primary key as foreign keys in the other tables, even though there is no data in these tables.
So how do I make NHibernate understand, that even if there are no matching foreign keys in the other tables of the object I am deleting from table one, it should throw no exception and shouldn't expect to actually find the keys of the object in the other database tables?
Also, I'd rather let the database take care of the cascading work, but when the database is generated from NHibernate.Tool.hbm2ddl.SchemaExport, the foreign key constraints necessary for the database's cascading should be generated. How do I accomplish this?