NHibernate mapping self joined table?

You need many-to-one mapping instead one-to-one. Try this configuration.

You need many-to-one mapping instead one-to-one. Try this configuration: I suggest you to try Fluent Nbernate - it can dynamically generate mappings for you. Here's the configuration I used: var fluent = Fluently.Configure() .

Mappings(c => c.AutoMappings. Add(AutoMap.AssemblyOf() . Override(u => u.Id(uu => uu.

Unit_Id).GeneratedBy.Native()))) . Database(() => SQLiteConfiguration.Standard. UsingFile("test.

Sqlite3")); var configuration = fluent. BuildConfiguration(); // Generate database schema new SchemaExport(configuration). Create(false, true); var sessionFactory = configuration.

BuildSessionFactory(); // Now just open session and do whatever you need.

The Main_Unit is referencing just only one Units enitty reference as I mentioned, there is only one table Units. And what is that coluumn Main_Unit_id in your configuration there is no Main_Unit table it is just only Units table. – MGA Jun 18 at 8:08 One-to-one would mean that you won't be able to express g and mg in kg (i.e.

Something like 1000 g == kg, 1,000,000 == 1 kg). In your case many different 'fractional' units may be expressed in the same Main_Unit so you need many-to-one. Main_Unit_id references object Units (which is mapped to table Units), in your example this corresponds to the column Main_Unit.

Fluent Nbernate just has this naming convention of appending _id for foreign key columns. You can override this convention the same way I did with Id generator – Konstantin Spirin Jun 18 at 16:06.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions