NHibernate uses its own Firebird generator

Having my own generator in Firebird DB called GEN_PATIENT_ID

, I would like to leave the id generation on the DB side, not NHibernate and FluentNHibernate. Following this link, I am overriding the default behavior of Fluent like this :

public class PatientOverride : IAutoMappingOverride<Patient>
    {
        public void Override(AutoMapping<Patient> mapping)
        {
            mapping.Cache.ReadOnly().Region("LongTermReadWrite");
            mapping.Id(x => x.Id).GeneratedBy.Sequence("GEN_PATIENT_ID");
            mapping.HasOne(patient => patient.Tag).Not.LazyLoad().Cascade.All();
        }
    }

      

However, I still get the error because NHibernate is trying to create its own file:

{"Dynamic SQL error error \ r \ nSQL error code = -204 \ r \ nTable unknown \ r \ nHIBERNATE_UNIQUE_KEY \ r \ nIn line 1, column 42"}

Double check if I import overrides and it should be OK:

mappings.UseOverridesFromAssemblyOf<AutoPersistenceModelGenerator>();

saving is pretty much standard:

var patient = patientDtoMapper.MapFrom(patientDto);

using (ITransaction t = NHibernateSession.Current.BeginTransaction())
{
    patientRepository.Save(patient);                
    t.Commit();
}

      

Any ideas?

+2
c # nhibernate firebird fluent-nhibernate


source to share


No one has answered this question yet

See similar questions:

1
How do I create IDs using NHibernate and Firebird?

or similar:

1758
How do I generate a random int?
1106
Create a generic method limiting T to Enum
868
How do I use reflection to call a generic method?
662
Random number generator only generates one random number
8
NHibernate with Firebird ... are these features included?
6
NHibernate Has-Many collection with cascading delete does not work
five
NHibernate will persist but not load the object
2
Why is calling Session.Clear () causing this test to fail?
1
Fluent NHibernate update after insert on composite key
0
Free Nhibernate Connect to Firebird



All Articles
Loading...
X
Show
Funny
Dev
Pics