You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ddlutils-dev@db.apache.org by "Dave Sunerton-Burl (JIRA)" <ji...@apache.org> on 2005/07/15 21:54:09 UTC
[jira] Created: (DDLUTILS-3) Column names are different case between getInstance and query in DynaSql
Column names are different case between getInstance and query in DynaSql
------------------------------------------------------------------------
Key: DDLUTILS-3
URL: http://issues.apache.org/jira/browse/DDLUTILS-3
Project: DdlUtils
Type: Bug
Environment: HSQLDB
Reporter: Dave Sunerton-Burl
Assigned to: Thomas Dudziak
When getting a DynaBean using getInstance("TABLE_NAME") the property names are uppercase. When getting a DynaBean from an Iterator using query("SELECT * FROM TABLE_NAME") the properties are lowercase. This means that the copy() method returns a DynaBean where all the properties are null, which makes doing updates difficult.
I have a test method in my code which shows this problem;
public void testColumnNames() throws Exception {
JdbcModelReader reader = new JdbcModelReader(loaderDb.getDataSource()
.getConnection());
Database database = reader.getDatabase();
DynaSql dynaSql = new DynaSql(
SqlBuilderFactory.newSqlBuilder("hsqldb"), loaderDb
.getDataSource(), database);
DynaBean beanFromSchema = dynaSql.newInstance("TEST");
Iterator iter = dynaSql.query("SELECT * FROM TEST");
DynaBean beanFromQuery = (DynaBean) iter.next();
assertEquals(beanFromSchema.getDynaClass().getDynaProperties()[0]
.getName(), beanFromQuery.getDynaClass().getDynaProperties()[0]
.getName());
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
[jira] Commented: (DDLUTILS-3) Column names are different case between getInstance and query in DynaSql
Posted by "Dave Sunerton-Burl (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/DDLUTILS-3?page=comments#action_12317959 ]
Dave Sunerton-Burl commented on DDLUTILS-3:
-------------------------------------------
Which of the supported databases has this been tested successfully on?
> Column names are different case between getInstance and query in DynaSql
> ------------------------------------------------------------------------
>
> Key: DDLUTILS-3
> URL: http://issues.apache.org/jira/browse/DDLUTILS-3
> Project: DdlUtils
> Type: Bug
> Environment: HSQLDB
> Reporter: Dave Sunerton-Burl
> Assignee: Thomas Dudziak
>
> When getting a DynaBean using getInstance("TABLE_NAME") the property names are uppercase. When getting a DynaBean from an Iterator using query("SELECT * FROM TABLE_NAME") the properties are lowercase. This means that the copy() method returns a DynaBean where all the properties are null, which makes doing updates difficult.
> I have a test method in my code which shows this problem;
> public void testColumnNames() throws Exception {
> JdbcModelReader reader = new JdbcModelReader(loaderDb.getDataSource()
> .getConnection());
> Database database = reader.getDatabase();
> DynaSql dynaSql = new DynaSql(
> SqlBuilderFactory.newSqlBuilder("hsqldb"), loaderDb
> .getDataSource(), database);
> DynaBean beanFromSchema = dynaSql.newInstance("TEST");
> Iterator iter = dynaSql.query("SELECT * FROM TEST");
> DynaBean beanFromQuery = (DynaBean) iter.next();
> assertEquals(beanFromSchema.getDynaClass().getDynaProperties()[0]
> .getName(), beanFromQuery.getDynaClass().getDynaProperties()[0]
> .getName());
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
[jira] Resolved: (DDLUTILS-3) Column names are different case between getInstance and query in DynaSql
Posted by "Thomas Dudziak (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/DDLUTILS-3?page=all ]
Thomas Dudziak resolved DDLUTILS-3:
-----------------------------------
Resolution: Fixed
The fix for DDLUTILS-2 includes the matching of columns to properties. This however depends upon the jdbc driver which must return the table names in the result set meta data. Eg. for PostgreSQL this doesn't work because the driver does not return any info.
I don't think I'll add a query parser. If need be I could however add the ability to provide hints as to which tables are queried against (as additional arguments to query/fetch).
> Column names are different case between getInstance and query in DynaSql
> ------------------------------------------------------------------------
>
> Key: DDLUTILS-3
> URL: http://issues.apache.org/jira/browse/DDLUTILS-3
> Project: DdlUtils
> Type: Bug
> Environment: HSQLDB
> Reporter: Dave Sunerton-Burl
> Assignee: Thomas Dudziak
>
> When getting a DynaBean using getInstance("TABLE_NAME") the property names are uppercase. When getting a DynaBean from an Iterator using query("SELECT * FROM TABLE_NAME") the properties are lowercase. This means that the copy() method returns a DynaBean where all the properties are null, which makes doing updates difficult.
> I have a test method in my code which shows this problem;
> public void testColumnNames() throws Exception {
> JdbcModelReader reader = new JdbcModelReader(loaderDb.getDataSource()
> .getConnection());
> Database database = reader.getDatabase();
> DynaSql dynaSql = new DynaSql(
> SqlBuilderFactory.newSqlBuilder("hsqldb"), loaderDb
> .getDataSource(), database);
> DynaBean beanFromSchema = dynaSql.newInstance("TEST");
> Iterator iter = dynaSql.query("SELECT * FROM TEST");
> DynaBean beanFromQuery = (DynaBean) iter.next();
> assertEquals(beanFromSchema.getDynaClass().getDynaProperties()[0]
> .getName(), beanFromQuery.getDynaClass().getDynaProperties()[0]
> .getName());
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
[jira] Updated: (DDLUTILS-3) Column names are different case
between getInstance and query in DynaSql
Posted by "Thomas Dudziak (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/DDLUTILS-3?page=all ]
Thomas Dudziak updated DDLUTILS-3:
----------------------------------
Component: Core (No specific database)
> Column names are different case between getInstance and query in DynaSql
> ------------------------------------------------------------------------
>
> Key: DDLUTILS-3
> URL: http://issues.apache.org/jira/browse/DDLUTILS-3
> Project: DdlUtils
> Type: Bug
> Components: Core (No specific database)
> Environment: HSQLDB
> Reporter: Dave Sunerton-Burl
> Assignee: Thomas Dudziak
>
> When getting a DynaBean using getInstance("TABLE_NAME") the property names are uppercase. When getting a DynaBean from an Iterator using query("SELECT * FROM TABLE_NAME") the properties are lowercase. This means that the copy() method returns a DynaBean where all the properties are null, which makes doing updates difficult.
> I have a test method in my code which shows this problem;
> public void testColumnNames() throws Exception {
> JdbcModelReader reader = new JdbcModelReader(loaderDb.getDataSource()
> .getConnection());
> Database database = reader.getDatabase();
> DynaSql dynaSql = new DynaSql(
> SqlBuilderFactory.newSqlBuilder("hsqldb"), loaderDb
> .getDataSource(), database);
> DynaBean beanFromSchema = dynaSql.newInstance("TEST");
> Iterator iter = dynaSql.query("SELECT * FROM TEST");
> DynaBean beanFromQuery = (DynaBean) iter.next();
> assertEquals(beanFromSchema.getDynaClass().getDynaProperties()[0]
> .getName(), beanFromQuery.getDynaClass().getDynaProperties()[0]
> .getName());
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
[jira] Commented: (DDLUTILS-3) Column names are different case between getInstance and query in DynaSql
Posted by "Thomas Dudziak (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/DDLUTILS-3?page=comments#action_12318233 ]
Thomas Dudziak commented on DDLUTILS-3:
---------------------------------------
I've tested the new Derby release, and it returns the table names. In this case, DdlUtils is able to map the returned column names to the column names defined in the database schema. This even works for joins (with Derby at least) as an additional unit test shows.
> Column names are different case between getInstance and query in DynaSql
> ------------------------------------------------------------------------
>
> Key: DDLUTILS-3
> URL: http://issues.apache.org/jira/browse/DDLUTILS-3
> Project: DdlUtils
> Type: Bug
> Environment: HSQLDB
> Reporter: Dave Sunerton-Burl
> Assignee: Thomas Dudziak
>
> When getting a DynaBean using getInstance("TABLE_NAME") the property names are uppercase. When getting a DynaBean from an Iterator using query("SELECT * FROM TABLE_NAME") the properties are lowercase. This means that the copy() method returns a DynaBean where all the properties are null, which makes doing updates difficult.
> I have a test method in my code which shows this problem;
> public void testColumnNames() throws Exception {
> JdbcModelReader reader = new JdbcModelReader(loaderDb.getDataSource()
> .getConnection());
> Database database = reader.getDatabase();
> DynaSql dynaSql = new DynaSql(
> SqlBuilderFactory.newSqlBuilder("hsqldb"), loaderDb
> .getDataSource(), database);
> DynaBean beanFromSchema = dynaSql.newInstance("TEST");
> Iterator iter = dynaSql.query("SELECT * FROM TEST");
> DynaBean beanFromQuery = (DynaBean) iter.next();
> assertEquals(beanFromSchema.getDynaClass().getDynaProperties()[0]
> .getName(), beanFromQuery.getDynaClass().getDynaProperties()[0]
> .getName());
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
[jira] Commented: (DDLUTILS-3) Column names are different case between getInstance and query in DynaSql
Posted by "Thomas Dudziak (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/DDLUTILS-3?page=comments#action_12316084 ]
Thomas Dudziak commented on DDLUTILS-3:
---------------------------------------
Yeah, thats because most databases are case insensitive. Since this info is available, it should be possible to match (upon reading) the property names of the beans with the model, and use the column names from the model. I'll have a look into it.
> Column names are different case between getInstance and query in DynaSql
> ------------------------------------------------------------------------
>
> Key: DDLUTILS-3
> URL: http://issues.apache.org/jira/browse/DDLUTILS-3
> Project: DdlUtils
> Type: Bug
> Environment: HSQLDB
> Reporter: Dave Sunerton-Burl
> Assignee: Thomas Dudziak
>
> When getting a DynaBean using getInstance("TABLE_NAME") the property names are uppercase. When getting a DynaBean from an Iterator using query("SELECT * FROM TABLE_NAME") the properties are lowercase. This means that the copy() method returns a DynaBean where all the properties are null, which makes doing updates difficult.
> I have a test method in my code which shows this problem;
> public void testColumnNames() throws Exception {
> JdbcModelReader reader = new JdbcModelReader(loaderDb.getDataSource()
> .getConnection());
> Database database = reader.getDatabase();
> DynaSql dynaSql = new DynaSql(
> SqlBuilderFactory.newSqlBuilder("hsqldb"), loaderDb
> .getDataSource(), database);
> DynaBean beanFromSchema = dynaSql.newInstance("TEST");
> Iterator iter = dynaSql.query("SELECT * FROM TEST");
> DynaBean beanFromQuery = (DynaBean) iter.next();
> assertEquals(beanFromSchema.getDynaClass().getDynaProperties()[0]
> .getName(), beanFromQuery.getDynaClass().getDynaProperties()[0]
> .getName());
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira