|
Hello
I have a problem with the new version of MyBatis v3.1.1 when the column name of my statment is in lowercase : select COL1 as "col1" from T_TABLE with the this resulMap : <resultMap id="test" type="test.TestBean"> <id property="col1" column="col1"/> <resultMap> I get this error : ### Error querying database. Cause: java.sql.SQLSyntaxErrorException: An undefined column name was detected. I check on source of mybatis on remark that method prependPrefix on the FastResultSetHandler (line 306) upercase all column name before retrive the data from column name or my column is to not found because is not in upercase but in lowercase. How can I solve this problem except I upcase all columns of all my statment ? Duto |
|
Hi Olivier,
Please let me clarify to narrow it down. Does it work as expected with MyBatis 3.0.6 and 3.1.0? // Iwao 2012/3/21 Olivier Dutrieux <[hidden email]>: > Hello > > I have a problem with the new version of MyBatis v3.1.1 when the > column name of my statment is in lowercase : > > select COL1 as "col1" > from T_TABLE > > with the this resulMap : > > <resultMap id="test" type="test.TestBean"> > <id property="col1" column="col1"/> > <resultMap> > > > > I get this error : > ### Error querying database. Cause: java.sql.SQLSyntaxErrorException: > An undefined column name was detected. > > I check on source of mybatis on remark that method prependPrefix on > the FastResultSetHandler (line 306) upercase all column name before > retrive the data from column name or my column is to not found because > is not in upercase but in lowercase. > > How can I solve this problem except I upcase all columns of all my > statment ? > > Duto > |
|
Being a DBA and long time developer, you should never make your table names or column names case sensitive. If you changed the table name or column name to all caps, everything will work unless you actually use double quotes in your sql to force case sensitivity.
On Wed, Mar 21, 2012 at 9:29 AM, Iwao AVE! <[hidden email]> wrote: Hi Olivier, -- Greg Hintz 608 395-5123 |
|
In reply to this post by Iwao AVE!
yes that work on 3.0.6
On 21 mar, 15:29, "Iwao AVE!" <[hidden email]> wrote: > Hi Olivier, > > Please let me clarify to narrow it down. > Does it work as expected with MyBatis 3.0.6 and 3.1.0? > > // Iwao > > 2012/3/21 Olivier Dutrieux <[hidden email]>: > > > > > > > > > Hello > > > I have a problem with the new version of MyBatis v3.1.1 when the > > column name of my statment is in lowercase : > > > select COL1 as "col1" > > from T_TABLE > > > with the this resulMap : > > > <resultMap id="test" type="test.TestBean"> > > <id property="col1" column="col1"/> > > <resultMap> > > > I get this error : > > ### Error querying database. Cause: java.sql.SQLSyntaxErrorException: > > An undefined column name was detected. > > > I check on source of mybatis on remark that method prependPrefix on > > the FastResultSetHandler (line 306) upercase all column name before > > retrive the data from column name or my column is to not found because > > is not in upercase but in lowercase. > > > How can I solve this problem except I upcase all columns of all my > > statment ? > > > Duto |
|
According to the spec, java.sql.ResultSet#getXxx() methods are case insensitive.
http://docs.oracle.com/javase/1.5.0/docs/api/java/sql/ResultSet.html Which driver do you use? 2012/3/22 Olivier Dutrieux <[hidden email]>: > yes that work on 3.0.6 > > On 21 mar, 15:29, "Iwao AVE!" <[hidden email]> wrote: >> Hi Olivier, >> >> Please let me clarify to narrow it down. >> Does it work as expected with MyBatis 3.0.6 and 3.1.0? >> >> // Iwao >> >> 2012/3/21 Olivier Dutrieux <[hidden email]>: >> >> >> >> >> >> >> >> > Hello >> >> > I have a problem with the new version of MyBatis v3.1.1 when the >> > column name of my statment is in lowercase : >> >> > select COL1 as "col1" >> > from T_TABLE >> >> > with the this resulMap : >> >> > <resultMap id="test" type="test.TestBean"> >> > <id property="col1" column="col1"/> >> > <resultMap> >> >> > I get this error : >> > ### Error querying database. Cause: java.sql.SQLSyntaxErrorException: >> > An undefined column name was detected. >> >> > I check on source of mybatis on remark that method prependPrefix on >> > the FastResultSetHandler (line 306) upercase all column name before >> > retrive the data from column name or my column is to not found because >> > is not in upercase but in lowercase. >> >> > How can I solve this problem except I upcase all columns of all my >> > statment ? >> >> > Duto |
|
Hi Iwao, I run into this problem some time ago. Seems that not all
drivers are case insensitive. See this dev thread: http://groups.google.com/group/mybatis-dev/browse_thread/thread/2bee7ed6cfbe150d/fba1afb39fa7f599?lnk=gst&q=mappedColumnNames#fba1afb39fa7f599 On 21 mar, 17:48, "Iwao AVE!" <[hidden email]> wrote: > According to the spec, java.sql.ResultSet#getXxx() methods are case insensitive.http://docs.oracle.com/javase/1.5.0/docs/api/java/sql/ResultSet.html > > Which driver do you use? > > 2012/3/22 Olivier Dutrieux <[hidden email]>: > > > > > > > > > yes that work on 3.0.6 > > > On 21 mar, 15:29, "Iwao AVE!" <[hidden email]> wrote: > >> Hi Olivier, > > >> Please let me clarify to narrow it down. > >> Does it work as expected with MyBatis 3.0.6 and 3.1.0? > > >> // Iwao > > >> 2012/3/21 Olivier Dutrieux <[hidden email]>: > > >> > Hello > > >> > I have a problem with the new version of MyBatis v3.1.1 when the > >> > column name of my statment is in lowercase : > > >> > select COL1 as "col1" > >> > from T_TABLE > > >> > with the this resulMap : > > >> > <resultMap id="test" type="test.TestBean"> > >> > <id property="col1" column="col1"/> > >> > <resultMap> > > >> > I get this error : > >> > ### Error querying database. Cause: java.sql.SQLSyntaxErrorException: > >> > An undefined column name was detected. > > >> > I check on source of mybatis on remark that method prependPrefix on > >> > the FastResultSetHandler (line 306) upercase all column name before > >> > retrive the data from column name or my column is to not found because > >> > is not in upercase but in lowercase. > > >> > How can I solve this problem except I upcase all columns of all my > >> > statment ? > > >> > Duto |
|
Thank you for the info Eduardo,
That explains the issue. I will fix it as soon as possible. Sorry for the breakage! Regards, Iwao 2012/3/22 Eduardo <[hidden email]>: > Hi Iwao, I run into this problem some time ago. Seems that not all > drivers are case insensitive. See this dev thread: > > http://groups.google.com/group/mybatis-dev/browse_thread/thread/2bee7ed6cfbe150d/fba1afb39fa7f599?lnk=gst&q=mappedColumnNames#fba1afb39fa7f599 > > On 21 mar, 17:48, "Iwao AVE!" <[hidden email]> wrote: >> According to the spec, java.sql.ResultSet#getXxx() methods are case insensitive.http://docs.oracle.com/javase/1.5.0/docs/api/java/sql/ResultSet.html >> >> Which driver do you use? >> >> 2012/3/22 Olivier Dutrieux <[hidden email]>: >> >> >> >> >> >> >> >> > yes that work on 3.0.6 >> >> > On 21 mar, 15:29, "Iwao AVE!" <[hidden email]> wrote: >> >> Hi Olivier, >> >> >> Please let me clarify to narrow it down. >> >> Does it work as expected with MyBatis 3.0.6 and 3.1.0? >> >> >> // Iwao >> >> >> 2012/3/21 Olivier Dutrieux <[hidden email]>: >> >> >> > Hello >> >> >> > I have a problem with the new version of MyBatis v3.1.1 when the >> >> > column name of my statment is in lowercase : >> >> >> > select COL1 as "col1" >> >> > from T_TABLE >> >> >> > with the this resulMap : >> >> >> > <resultMap id="test" type="test.TestBean"> >> >> > <id property="col1" column="col1"/> >> >> > <resultMap> >> >> >> > I get this error : >> >> > ### Error querying database. Cause: java.sql.SQLSyntaxErrorException: >> >> > An undefined column name was detected. >> >> >> > I check on source of mybatis on remark that method prependPrefix on >> >> > the FastResultSetHandler (line 306) upercase all column name before >> >> > retrive the data from column name or my column is to not found because >> >> > is not in upercase but in lowercase. >> >> >> > How can I solve this problem except I upcase all columns of all my >> >> > statment ? >> >> >> > Duto |
|
It is me who has to apologize for not having written a test for that case.
I tried with postgres and hsqldb and both are case insensitive (at leasy with their default config). |
|
Hi Eduardo,
Yes, writing the test case for this seems to be harder than the fix itself :) I have opened a new ticket #557 and will commit the fix at first. (I missed the Olivier's report, sorry!) Then see if I can write a test case using mocks. jMock's syntax looks different from mockito's, so it may take some time. Regards, Iwao 2012/3/22 Eduardo Macarron <[hidden email]>: > It is me who has to apologize for not having written a test for that case. > > I tried with postgres and hsqldb and both are case insensitive (at > leasy with their default config). |
|
You have time.
This bug may be annoying but not critical and we should wait a bit more to see if there are new issues related to 3.1.0. For the time being let's let the 3.1.1-SNAPSHOT available for those who want to go 3.1.x. El día 22 de marzo de 2012 06:57, Iwao AVE! <[hidden email]> escribió: > Hi Eduardo, > > Yes, writing the test case for this seems to be harder than the fix itself > :) > I have opened a new ticket #557 and will commit the fix at first. > (I missed the Olivier's report, sorry!) > > Then see if I can write a test case using mocks. > jMock's syntax looks different from mockito's, so it may take some time. > > Regards, > Iwao > > 2012/3/22 Eduardo Macarron <[hidden email]>: > >> It is me who has to apologize for not having written a test for that case. >> >> I tried with postgres and hsqldb and both are case insensitive (at >> leasy with their default config). > |
|
In reply to this post by Iwao AVE!
I use JTOpen for DB2/400
On 21 mar, 17:48, "Iwao AVE!" <[hidden email]> wrote: > According to the spec, java.sql.ResultSet#getXxx() methods are case insensitive.http://docs.oracle.com/javase/1.5.0/docs/api/java/sql/ResultSet.html > > Which driver do you use? > > 2012/3/22 Olivier Dutrieux <[hidden email]>: > > > > > > > > > yes that work on 3.0.6 > > > On 21 mar, 15:29, "Iwao AVE!" <[hidden email]> wrote: > >> Hi Olivier, > > >> Please let me clarify to narrow it down. > >> Does it work as expected with MyBatis 3.0.6 and 3.1.0? > > >> // Iwao > > >> 2012/3/21 Olivier Dutrieux <[hidden email]>: > > >> > Hello > > >> > I have a problem with the new version of MyBatis v3.1.1 when the > >> > column name of my statment is in lowercase : > > >> > select COL1 as "col1" > >> > from T_TABLE > > >> > with the this resulMap : > > >> > <resultMap id="test" type="test.TestBean"> > >> > <id property="col1" column="col1"/> > >> > <resultMap> > > >> > I get this error : > >> > ### Error querying database. Cause: java.sql.SQLSyntaxErrorException: > >> > An undefined column name was detected. > > >> > I check on source of mybatis on remark that method prependPrefix on > >> > the FastResultSetHandler (line 306) upercase all column name before > >> > retrive the data from column name or my column is to not found because > >> > is not in upercase but in lowercase. > > >> > How can I solve this problem except I upcase all columns of all my > >> > statment ? > > >> > Duto |
|
Hi Olivier,
Thank you for the info! I will let you know as soon as the snapshot becomes available. Regards, Iwao 2012/3/22 Olivier Dutrieux <[hidden email]>: > I use JTOpen for DB2/400 |
|
In reply to this post by Eduardo Macarron
Eduardo,
I have attached a test case to issue #557. Could you please take a look when you have a time? It heavily relies on mocks and I am not sure if it's OK to commit. Thanks in advance, Iwao 2012/3/22 Eduardo Macarron <[hidden email]>: > You have time. > > This bug may be annoying but not critical and we should wait a bit > more to see if there are new issues related to 3.1.0. > > For the time being let's let the 3.1.1-SNAPSHOT available for those > who want to go 3.1.x. |
|
Impressive test :)
if it tests what it should test go commit it :) On 22 mar, 17:37, "Iwao AVE!" <[hidden email]> wrote: > Eduardo, > > I have attached a test case to issue #557. > Could you please take a look when you have a time? > It heavily relies on mocks and I am not sure if it's OK to commit. > > Thanks in advance, > Iwao > > 2012/3/22 Eduardo Macarron <[hidden email]>: > > > > > > > > > You have time. > > > This bug may be annoying but not critical and we should wait a bit > > more to see if there are new issues related to 3.1.0. > > > For the time being let's let the 3.1.1-SNAPSHOT available for those > > who want to go 3.1.x. |
|
OK, Thank you!
2012/3/23 Eduardo <[hidden email]>: > Impressive test :) > > if it tests what it should test go commit it :) |
|
In reply to this post by Iwao AVE!
Hi Olivier,
The snapshot is available at the Download section (thank you Eduardo). http://code.google.com/p/mybatis/downloads/list?can=3&q=Product%3DMyBatis+snapshot Regards, Iwao On Thursday, March 22, 2012 6:08:45 PM UTC+9, Iwao AVE! wrote: Hi Olivier, |
| Powered by Nabble | Edit this page |
