Hibernate version:
1.2 beta 2
I have used Hibernate in J2EE for the past year. I am trying to use NHibernate in a .Net 1.1 project and I am having problems trying to control the serialization of a property using the [NotSerialized] (I have tries 3 different spellings) attribute in the C# class. This is easy in the Java version. I keep getting a property Unresolved error...
Has anyone used the [NotSerialized] attribute for NHibernate?
FYI, this problem was cause because of a limitation in the mapping - Class A contains Class B which contains a collection of Class C. This works until you try to make a copy of Class B and C - which caused a NHibernate error (which corrupts the DB) - I think the nhibernate documentation calls this a collection element and is NOT supported. Therefore, I changed the design to use a weak reference between Class A and Class B and have Class manually 'Get any request for Class B from the DB' (simulating lazy loading). This all works until I try to make a copy of Class B (for user editing). The local instance variable in Class A of Class B causes a mapping problem even though I have the NotSerialized attribute associated with the property.
[NotSerialized]
Class B <- for the property definition
My guess is the Beta code is looking at the object and not respecting the [NotSerialized] attribute and creating the mapping code within the NHibernate system, and that mapping code cannot find the Get/Set routines for the property (which should not be there) causing the “Unresolved Error”.
Any help would be appreciated.
Mapping documents:
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
Name and version of the database you are using:
SQL Server 2000 SP4
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
Problems with Session and transaction handling?
Read this:
http://hibernate.org/42.html