Gionni wrote:
I have to manage a very large table with more then 200 columns.
I use column attribute to assign mapping between objects attributes and table columns.
For exmaple if I use column names like these:
column="CPO2_A112_XXXX_YYY"
column="CP02_A136_XXXX_YYY"
where XXXX_YYY represents the real name and type of the columns, NHibernate raises a class cast exception in Load operations.
If NHibernate is creating incorrect aliases in query (see downward), then it might explain the cast exception - properties and aliases might got swapped, so the value of string column is tried to load into int column, for example.
Gionni wrote:
If I use column names like these:
column="CPO2_XXXX_A1S_YYY"
column="CP02_XXXX_A1L_YYY"
no exceptions are raised but loaded object is different from the original in some attributes.
Using NHibernate.Cfg.Environment.ShowSql property, I saw the query produced by save operations includes all columns defined into the xml mapping file, but the query produced by Load method does not (I use isession.Load(typeof(ObjectClass), ObjectID) method, the primary key is a long). Not included columns are inizialized to 0 or empty strings in object instantiation and then result different from original data.
I seen that NHibernate translate column names using aliases like:
CPO2_A1ZZ_0_ where ZZ is a progressive number.
Sounds like NHibernate is creating same alias for multiple columns, and omitting column from query if aliases are same... You might want to create and jira issue for that.
Gionni wrote:
I would like to now if there are some limitation in column property syntax or length and/or the column naming convengion I use could create translation problems.
I would hope there are no syntax/format limitations. But there might be some bugs ;)
Gert