[hibernate-issues] [Hibernate-JIRA] Resolved: (HHH-1865) Group by does not expand columns
Christian Bauer (JIRA)
noreply at atlassian.com
Sun Sep 17 14:26:25 EDT 2006
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1865?page=all ]
Christian Bauer resolved HHH-1865:
----------------------------------
Resolution: Duplicate
> Group by does not expand columns
> --------------------------------
>
> Key: HHH-1865
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1865
> Project: Hibernate3
> Type: Bug
> Components: query-hql
> Environment: Windows XP
> JDeveloper 10.1.2.1
> Reporter: Nestor Boscán
> Priority: Minor
>
>
> Hi
> I need to use Hibernate 3.1.3 to create a query that returns an object and a aggregate value like this:
> select max (t.test_date), t from TestTo t.
> Because I have an aggregate function I have to define the GROUP BY clause:
> select max (t.test_date), t from TestTo t group by t
> But I get an error:
> ORA-00979: not a GROUP BY expression
> The generated SQL is:
> select max(testto0_.test_date) as col_0_0_,
> testto0_.test_value as col_1_0_,
> testto0_.test_value as test1_0_,
> testto0_.test_date as test2_0_
> from TEST testto0_
> group by testto0_.test_value
> It seems that Hibernate is expanding all columns of the TestTo class in the SELECT statement but not in the GROUP BY statement.
> The TestTo class:
> public class TestTo
> {
> private int value;
> private Date date;
> public TestTo()
> {
> }
> public int getValue()
> {
> return value;
> }
> public void setValue(int value)
> {
> this.value = value;
> }
> public Date getDate()
> {
> return date;
> }
> public void setDate(Date date)
> {
> this.date = date;
> }
> }
> The Mapping File:
> <hibernate-mapping>
> <class name="mypackage.TestTo" table="TEST">
> <id name="value" column="test_value">
> <generator class="sequence">
> <param name="sequence">seq_test</param>
> </generator>
> </id>
> <property name="date" column="test_date"/>
> </class>
> </hibernate-mapping>
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list