Hi Jakob,

You're right. I traced my problem further to a different point in OJB
where I do believe there is a problem (see my followup message).

Thanks,
Scott

-----Original Message-----
From: Jakob Braeuchi [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, February 26, 2003 3:45 PM
To: OJB Users List
Subject: Re: Bug in PersistenceBroker.getCount() ?


hi scott,

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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to