Re: Unknown column
Re: Unknown column
- Subject: Re: Unknown column
- From: Kieran Kelleher <email@hidden>
- Date: Thu, 13 Sep 2012 16:40:54 -0400
On Sep 13, 2012, at 4:24 PM, Chuck Hill <email@hidden> wrote:
> 1. If you don't fetch it then and fetch it later, does it work?
>
> 2. Is it a case difference? I recall that MySQL can be case sensitive.
It depends :) ..... here is a snippet from a linux mysql config file........
<snip>
# If set to 0, table names are stored as specified and comparisons are case
# sensitive. If set to 1, table names are stored in lowercase on disk and
# comparisons are not case sensitive. If set to 2, table names are stored as given
# but compared in lowercase. This option also applies to database names and table
# aliases. For additional information, see Section 8.2.2, “Identifier Case
# Sensitivity”.
# You should not set this variable to 0 if you are running MySQL on a system that
# has case-insensitive file names (such as Windows or Mac OS X). If you set this
# variable to 0 on such a system and access MyISAM tablenames using different
# lettercases, index corruption may result. On Windows the default value is 1. On
# Mac OS X, the default value is 2.
# If you are using InnoDB tables, you should set this variable to 1 on all
# platforms to force names to be converted to lowercase. Prior to MySQL Cluster
# NDB 6.3.35, MySQL Cluster NDB 7.0.15, and MySQL Cluster NDB 7.1.4, this is also
# true for tables using the NDB storage engine.
# KK: We want setting of 1 for innodb and linux compatability
# KK: Do not change this to 1 without first changing the actual table names to lower case first
lower_case_table_names = 1
</snip>
More info here:
https://github.com/kierankelleher/gic-mysql-tools/blob/master/Configurations/G038_innodb_linux_5.1_with_innodb_plugin_12corewestmere_my.cnf
https://github.com/kierankelleher/gic-mysql-tools
http://dev.mysql.com/doc/refman/5.0/en/identifier-case-sensitivity.html
http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html#sysvar_lower_case_table_names
>
>
> Chuck
>
>
> On 2012-09-13, at 1:11 PM, Ângelo Andrade Cirino wrote:
>
>> Hi all,
>>
>> What can cause this error?
>>
>> 13 Set 16:21:50 vtta[60002] DEBUG NSLog - === Begin Internal Transaction
>> 13 Set 16:21:50 vtta[60002] DEBUG NSLog - evaluateExpression: <com.webobjects.jdbcadaptor._MySQLPlugIn$MySQLExpression: "SELECT t0.agência_id, RTRIM(t0.descrição), RTRIM(t0.domínio), t0.entidade_id, t0.imagem_grande_altura, t0.imagem_grande_largura, t0.imagem_pequena_altura, t0.imagem_pequena_largura, t0.logomarca_id, t0.miniatura_altura, t0.miniatura_largura, t0.número_pacotes_principais, t0.parteID, t0.situação, t0.temaID, RTRIM(t0.título_páginas), RTRIM(t0.título_site) FROM agência t0 WHERE t0.agência_id = ?" withBindings: 1:1(agênciaID)>
>> 13 Set 16:21:50 vtta[60002] DEBUG NSLog - === Rollback Internal Transaction
>> 13 Set 16:21:50 vtta[60002] INFO er.transaction.adaptor.Exceptions - Database Exception occured: Unknown column 't0.logomarca_id' in 'field list'at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>> at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
>> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
>> at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
>> at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
>> at com.mysql.jdbc.Util.getInstance(Util.java:386)
>> at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1053)
>> at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4074)
>> at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4006)
>> at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2468)
>> at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2629)
>> at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2719)
>> at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2155)
>> at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1379)
>> at com.webobjects.jdbcadaptor.JDBCChannel._bindInputVariablesWithBindingsAndExecute(JDBCChannel.java:265)
>> at com.webobjects.jdbcadaptor.JDBCChannel._evaluateExpression(JDBCChannel.java:337)
>> at com.webobjects.jdbcadaptor.JDBCChannel.evaluateExpression(JDBCChannel.java:296)
>> at com.webobjects.jdbcadaptor.JDBCChannel.selectAttributes(JDBCChannel.java:220)
>> at com.webobjects.eoaccess.EODatabaseChannel._selectWithFetchSpecificationEditingContext(EODatabaseChannel.java:897)
>> at com.webobjects.eoaccess.EODatabaseChannel.selectObjectsWithFetchSpecification(EODatabaseChannel.java:234)
>> at com.webobjects.eoaccess.EODatabaseContext._objectsWithFetchSpecificationEditingContext(EODatabaseContext.java:3055)
>> at com.webobjects.eoaccess.EODatabaseContext.objectsWithFetchSpecification(EODatabaseContext.java:3195)
>> at com.webobjects.eocontrol.EOObjectStoreCoordinator.objectsWithFetchSpecification(EOObjectStoreCoordinator.java:488)
>> at com.webobjects.eocontrol.EOEditingContext.objectsWithFetchSpecification(EOEditingContext.java:4069)
>> at er.extensions.eof.ERXEC.objectsWithFetchSpecification(ERXEC.java:1306)
>> at com.webobjects.eocontrol.EOEditingContext.objectsWithFetchSpecification(EOEditingContext.java:4444)
>> at com.visionar.modelos._Agência.fetchAgênciaPorID(_Agência.java:879)
>> at vtta.app.Application.<init>(Application.java:48)
>> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>> at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
>> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
>> at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
>> at java.lang.Class.newInstance0(Class.java:355)
>> at java.lang.Class.newInstance(Class.java:308)
>> at com.webobjects.appserver.WOApplication.main(WOApplication.java:547)
>> at er.extensions.appserver.ERXApplication.main(ERXApplication.java:826)
>> at vtta.app.Application.main(Application.java:31)
>>
>> This logomarcaID is the foreign key for an ERAttachment relationship. I assure you that the table has the column and that the model is correct. The generated class file correctly implements the logomarcaID field and the getter and setter methods. The generated migration class correctly creates the logomarca_id table column. Finally, I have two other applications using the very same model (the model is kept in a framework) that do work and do not show this error.
>>
>> It occurs when I try to fetch an entity at the beginning of the application, it is the first fetch. I tried with a fetch specification I created and with a EOUtilities fetch and the outcome is the same. These are the two methods:
>>
>> @Override
>> public void finishInitialization() {
>> super.finishInitialization();
>>
>> //agência = Agência.fetchAgênciaPorID(editingContext(), agênciaID).objectAtIndex(0);
>> agência = (Agência) EOUtilities.objectsMatchingKeyAndValue(editingContext(), "Agência", "agênciaID", 1).objectAtIndex(0);
>> NSLog.out.appendln("*** Sistema de aplicação web Visiontur para a agência " + agência.títuloSite());
>> }
>>
>> Of course I use one or the other, not both at the same time. Regarding the UTF-8 characters, I have been using them without problem, but in a few points that I have very early identified and were UTF-8 is avoided.
>>
>> Angelo
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>
> --
> Chuck Hill Senior Consultant / VP Development
>
> Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
> http://www.global-village.net/gvc/practical_webobjects
>
>
>
>
>
>
>
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden