cancel
Showing results for 
Search instead for 
Did you mean: 

SchemaUpdate Error on SQL Anywhere 12 with NHibernate 3.3.2 and dialect SybaseSQLAnywhere12Dialect

Former Member
8,375

If the database is empty (no tables created), the SchemaUpdate works fine, create all db objects and so. But if another call to SchemaUpdate is called, even if no Mappings or Objects were made, some action is made and finalizes with the error message "Column 'COLUMN_SIZE' does not belong to table" on schemaUpdate.Exceptions[0].

Stack trace: [HttpException (0x80004005): Column 'COLUMN_SIZE' does not belong to table .] System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +9859725 System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +118 System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172 System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +336 System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296

[HttpException (0x80004005): Column 'COLUMN_SIZE' does not belong to table .] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9873912 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254

Former Member
0 Kudos

I'm having the same problem with SchemaValidate.

Accepted Solutions (0)

Answers (1)

Answers (1)

jeff_albion
Advisor
Advisor

Hello,

When posting issues to the forum, please include a code sample so that we can reproduce your issue - this will assist us in understanding the precise issue you're seeing.

  1. Regarding hbm2ddl and updating schemas, it isn't generally recommended to run 'hbm2ddl.auto=update' in production and Hibernate does not generally expect DDL updates after start-up. So, in terms of NHibernate features, this issue should really only affect development/testing. For schema validations, the 'hbm2ddl.auto=validate' only needs to be run once upon start-up and can thus just be a Configuration property - you should not have to call NHibernate.Tool.hbm2ddl.SchemaValidate directly:

    Configuration cfg = new Configuration(); cfg.Properties["hbm2ddl.auto"] = "validate";

  2. This issue is caused by CR #631249 - any ADO.NET provider prior to these builds (10.0.1.4079, 11.0.1.2444, 12.0.0.1242) will not have the 'COLUMN_SIZE' issue. If you have an ADO.NET provider higher than these builds, the NHibernate 'Schema' files will have to be modified.

In \\Dialect\\Schema\\SQLAnywhere11MetaData.cs (from Glenn Paulley's blog):

object objValue = rs["COLUMN_SIZE"];

becomes:

object objValue = rs["CHARACTER_MAXIMUM_LENGTH"];

In \\Dialect\\Schema\\SybaseAnywhereMetaData.cs (from the default Hibernate install):

this.SetColumnSize(rs["COLUMN_SIZE"]);

becomes:

this.SetColumnSize(rs["CHARACTER_MAXIMUM_LENGTH"]);

I will investigate to see if we can open an NHibernate request to fix this issue in the official NHibernate package. Thank you for the bug report.