I am using NHibernate on a project. The database is required to have creation date and creator user fields on relation tables but I do not want to map the relations to domains. My db design is like:
school (id, name, credate, creuser)
student (id, name, credate, creuser)
school_student(id, school_id, student_id, credate, creuser)
For school_student.id, I use autoincrement, pk, not null, so I do not have to map it. NHibernate automatically manages relations so I do not have to map school_id and student_id. For credate, I can use getdate() function, so I do not have to map this field.
But for creuser field, I cannot think of a way that so I do not have to create a domain class for school_student table. How can I escape creating a domain for school_student table? Is there a way of sending creuser information to database each time NHibernate inserts a recort into this table?