Re: Unknown column
Re: Unknown column
- Subject: Re: Unknown column
- From: Johann Werner <email@hidden>
- Date: Thu, 13 Sep 2012 22:51:41 +0200
Have you tried to copy the SQL string from the log and to run it directly in MySQL? Does MySQL report a different/more precise error message? If it returns a correct result there the error lies within WO otherwise your DB/config has to be checked.
Am 13.09.2012 um 22:43 schrieb Ângelo Andrade Cirino <email@hidden>:
> Hi Chuck,
>
> 1. Unfortunately I must fetch it at the very beginning of the application, since all the other entities will be fetched from a to many relationship from this entity.
>
> 2. No case difference, I have checked and rechecked it. I have even erased the database and migrated it again to version 0 to be sure that there was no error in its creation.
>
> Angelo
>
> Em 13/09/2012, às 17:24, Chuck Hill escreveu:
>
>> 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.
>>
>>
>> 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