NHibernate FK is CHAR (6) and various queries fail because the PK child table is CHAR (6)

I have a legacy Oracle database that has multiple 1: n lookup tables that are based on CHAR (6) primary keys in child tables. Unfortunately, I'm not the only one who has problems with how NHibernate deals with char fields (especially primary keys). Cm:

I'm going to implement a custom type to deal with the problems, but wanted to check if there is a better way as it still seems like there is some confusion about how to treat char fields as keys in the session. Get () ... and session.Load () ... (and therefore, since these tables are central to our application, I want to make sure it doesn't need to be redone). I'm sure I'm not the only one who ran into this, and I would greatly appreciate any guidance from more experienced NHibernate users.

To make things more interesting, using NHibernate with Oracle does throw in some curves that I didn't expect.

0


source to share


1 answer


Looks like update 2.0.1. GA solved most of the problems (if they weren't a problem for me to misconfigure). Lazy load load fine on foreign keys even if they are char (6) but length less than 6. session.Get and session.Load work fine if you include trailing spaces.



I can still implement UserType to get rid of trailing spaces for display.

0


source







All Articles