0

Running ASP.NET MVC application under apache + mod_mono + mysql I get this error:

MySql.Data.MySqlClient.MySqlException
Unknown column 'this_.date_created' in 'field list'

Exception:

NHibernate.HibernateException: Error executing multi criteria : [SELECT count(*) as y0_ FROM tag this_;
SELECT this_.id as id4_0_, this_.name as name4_0_, this_.description as descript3_4_0_, this_.date_created as date4_4_0_, this_.total_peruns as total5_4_0_, this_.user_id as user6_4_0_ FROM tag this_ ORDER BY this_.total_peruns desc limit ?p0;
] ---> MySql.Data.MySqlClient.MySqlException: Unknown column 'this_.date_created' in 'field list'
  at MySql.Data.MySqlClient.MySqlStream.ReadPacket () [0x00000] in <filename unknown>:0 
  at MySql.Data.MySqlClient.NativeDriver.ReadResult () [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
at NHibernate.Impl.MultiCriteriaImpl.GetResultsFromDatabase (System.Collections.IList) <0x0097f>
at NHibernate.Impl.MultiCriteriaImpl.DoList () <0x0003f>
at NHibernate.Impl.MultiCriteriaImpl.ListIgnoreQueryCache () <0x0000f>
at NHibernate.Impl.MultiCriteriaImpl.List () <0x00297>
at NHibernate.Impl.FutureCriteriaBatch.GetResultsFrom (NHibernate.IMultiCriteria) <0x0001d>
at NHibernate.Impl.FutureBatch`2<NHibernate.ICriteria, NHibernate.IMultiCriteria>.GetResults () <0x00110>
at NHibernate.Impl.FutureBatch`2<NHibernate.ICriteria, NHibernate.IMultiCriteria>.get_Results () <0x0001f>
at NHibernate.Impl.FutureBatch`2<NHibernate.ICriteria, NHibernate.IMultiCriteria>.GetCurrentResult<perun.domain.model.entities.Tag> (int) <0x00027>
at NHibernate.Impl.FutureBatch`2/<>c__DisplayClass4`1<NHibernate.ICriteria, NHibernate.IMultiCriteria, perun.domain.model.entities.Tag>.<GetEnumerator>b__3 () <0x00043>
    ...

The date_created column exists in that table.

The same application works on my windows dev machine with windows version of mysql.

MySQL Linux: 5.5.34

MySQL Windows: 5.6.12

nHibernate version: 3.1.0.4000

SQL generated executes correctly in database (?p0 = 10):

SELECT this_.id as id4_0_, this_.name as name4_0_, this_.description as descript3_4_0_, this_.date_created as date4_4_0_, this_.total_peruns as total5_4_0_, this_.user_id as user6_4_0_ FROM tag this_ ORDER BY this_.total_peruns desc limit ?p0;

What could be causing this problem?

Artur Kedzior
  • 3,994
  • 1
  • 36
  • 58

1 Answers1

0

This things happen to everyone. Nothing wrong with environments, libraries or MySQL. My connection string was pointing to the old version of the database. Web.config

  <connectionStrings>
   <add name="localhost" connectionString="Server=name;Database=old_database_version;User id=user;Password=pass;"/>   
  </connectionStrings>

Thank you all for your efforts and time.

Artur Kedzior
  • 3,994
  • 1
  • 36
  • 58