i just did some tests with proxied m:n association where getCount() is called. i changed the test-classes to have a difference between column-name and attribute-name. so far everything was ok.
the attribute-name will be translated into column-name by the SqlGenerator., so there should be no need to specify it in getCount().
jakob
Scott Howlett wrote:
I just changed my database schema such that one of my tables now has a primary key field whose name is different than the column name in the database.
Things worked OK in general until I referenced the table from another table via an M:N association. I then got an SQL exception complaining that I was trying to access the table using the field name, not the column name.
I think I've traced the problem to PersistenceBrokerImpl.getCount(Query) - in this routine a report query is made, but it's being populated with attribute names, not column names. The offending lines of code:
for (int i = 0; i < pkFields.length; i++) { if (query.isDistinct()) { columns[i] = "count(distinct " + pkFields[i].getAttributeName() + ")"; } else { columns[i] = "count(" + pkFields[i].getAttributeName() + ")"; } }
Should the above getAttributeName() calls should be replaced with getColumnName() instead?
Regards, Scott Howlett
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]