I have a legacy Oracle database that has multiple 1:n lookup tables that are based on CHAR(6) primary keys in the child tables. Unfortunately, I'm not the only one who has problems with how NHibernate deals with char fields (especially with those as primary keys). See:
- http://forum.hibernate.org/viewtopic.php?t=984281
- http://forum.hibernate.org/viewtopic.php?t=975743
- http://forum.hibernate.org/viewtopic.php?p=2382974
- http://www.hibernate.org/388.html
- ...and many more....
I'm about to implement a custom usertype to deal with the issues, but wanted to check to see if there's a better way as there still seems to be some confusion over how to deal char fields as keys in session.Get()... and session.Load()... (and therefore, as these tables are central to our application, I want to make sure it doesn't have to be redone). I am sure I am not the only one to have run into this, and I'd greatly appreciate any recommendations from more experienced NHibernate users out there.
To make things more interesting, using NHibernate with Oracle does throw some curveballs that I wasn't expecting.