Skip to content

Loading…

Bug when trying to change varchar length for CompositeId #200

Closed
phinoppix opened this Issue · 6 comments

3 participants

@phinoppix

I am using Firebird 2.5 with FluentNH 1.3. Database is UTF8 encoded. Below is my composite id mapping:

CompositeId()
.KeyProperty(e => e.TransactId, "TransactId")
.KeyProperty(e => e.TransactType, p =>
{
p.ColumnName("TType");
p.Length(2);
})
.KeyReference(e => e.Entity, "EntityId");

NH creates the TType field as varchar(255). The generated hbm is...

< composite-id>
< key-property name="TransactId" type="Int64">
< column name="TransactId" />
< /key-property>
< key-property name="TransactType" type="String" length="2">
< column name="TransactType" />
< /key-property>
< key-many-to-one name="Entity" type="Int64">
< column name="EntityId" />
< /key-many-to-one>
< /composite-id>

Note that the TransactId and EntityId fields are bigint, adding the varchar(255) UTF8 exceeds Firebird's index length. If the length attribute is on the element, the composite id is created correctly.

@jasminsehic

I have the same issue with MSSQL. HBM generated contains the correct length specified in mapping of the KeyProperty but looking at generated schema I see varchar(255).

@chester89
Collaborator

then may be it's NHibernate problem? Because NH generates DDL itself, Fluent is just a convenient way to do the mapping without xml

@chester89
Collaborator

will have a look tomorrow

@chester89
Collaborator

Really need to learn to keep my promises - I will research this, guys.

@chester89
Collaborator

The problem is confirmed, but I believe it's on NHibernate side. They don't have a ticket for this currently, so I took a liberty of creating one https://nhibernate.jira.com/browse/NH-3400

@chester89
Collaborator

I'm going to close this for now. Let's see what guys from NH team can come up with

@chester89 chester89 closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.