[Hibernate-JIRA] Created: (HHH-6429) GROUP BY clause doesn't work with composite objects
by Fernando Santos (JIRA)
GROUP BY clause doesn't work with composite objects
---------------------------------------------------
Key: HHH-6429
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6429
Project: Hibernate Core
Issue Type: Bug
Components: query-hql
Affects Versions: 3.6.5
Environment: Firebird 2.1 Server, Hibernate 3.6.5, java 6, eclipse IDE
Reporter: Fernando Santos
Priority: Critical
I'm trying to run the HQL below in the latest hibernate version
{quote}
SELECT
m.account,
(SELECT sum(amount) from Movement where date > '20-02-2011') as primo
FROM
Movement m
GROUP BY
m.account
{quote}
The problem is when the HQL is parsed, the account fields are added to my SELECT query but not to my GROUP BY query like below. Has someone been faced the same problem?
Generated SQL:
{quote}
select movement0_.MOV_ACCOUNT_NUMBER as col_0_0_,
movement0_.MOV_ACCOUNT_AFDELING_ID as col_0_1_,
(select sum(movement2_.MOV_AMOUNT) from MOVEMENT movement2_) as col_1_0_,
account1_.KONTONR as KONTONR12_,
account1_.AFDELING_ID as AFDELING14_12_,
account1_.KON_FUNCTION as KON2_12_,
account1_.KON_BALANCE as KON3_12_,
account1_.KON_BLOCKED as KON4_12_,
account1_.KONTO_NAVN as KONTO5_12_,
account1_.KON_KEY_FIGURE_CODE as KON6_12_,
account1_.KON_MONITORED as KON7_12_,
account1_.KON_SUGGEST_CONTRA_ACC as KON8_12_,
account1_.KON_TOTALFROM as KON9_12_,
account1_.KON_TYPE as KON10_12_,
account1_.UAFD_GRP_NAVN as UAFD11_12_,
account1_.UAFD_NAVN as UAFD12_12_,
account1_.KON_TAX as KON15_12_,
account1_.OPTLOCK as OPTLOCK12_
from MOVEMENT movement0_
inner join KONTOPLAN account1_
on movement0_.MOV_ACCOUNT_NUMBER=account1_.KONTONR
and movement0_.MOV_ACCOUNT_AFDELING_ID=account1_.AFDELING_ID
group by
movement0_.MOV_ACCOUNT_NUMBER,
movement0_.MOV_ACCOUNT_AFDELING_ID
{quote}
Error
{quote}
Caused by: org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544569. Dynamic SQL Error
SQL error code = -104
Invalid expression in the select list (not contained in either an aggregate function or the GROUP BY clause)
{quote}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 3 months
[Hibernate-JIRA] Created: (HHH-7302) HQL uses multiple column Types in a inconsitent manner between Where and Order By clauses
by Miek Dunn (JIRA)
HQL uses multiple column Types in a inconsitent manner between Where and Order By clauses
-----------------------------------------------------------------------------------------
Key: HHH-7302
URL: https://hibernate.onjira.com/browse/HHH-7302
Project: Hibernate ORM
Issue Type: Bug
Components: query-hql
Affects Versions: 4.1.0
Environment: Java 1.7.0 Eclipse 3.7.2
Reporter: Miek Dunn
When a type maps to multiple columns and that type is used in HQL the generated SQL will order the values in different manner in the Order By clause then it does in the Where clause. The Order By clause assumes the fields are mapped in order of importance, while the where clause assumes not field is more important then any other.
For example assume a database stores a timestamp you using multiple fields (T2SCEN T2SYER T2SMTH T2SDAY T2STIM : century year month day time) and that there is a type that turns those fields into a Calendar. Now that type is used in an entity class named WorkOrder with a field named scheduled. The following HQL query:
{quote}
Select wo From WorkOrder wo WHERE wo.scheduled > :scheduled Order By wo.scheduled
{quote}
Will generate the following SQL
{quote}
select
...
from
SVDSPT workorder0_
where
workorder0_.T2SCEN>?
and workorder0_.T2SYER>?
and workorder0_.T2SMTH>?
and workorder0_.T2SDAY>?
and workorder0_.T2STIM>?
order by
workorder0_.T2SCEN,
workorder0_.T2SYER,
workorder0_.T2SMTH,
workorder0_.T2SDAY,
workorder0_.T2STIM
{quote}
The Order By clause will order the values as one would expect for date, that is 2012-05-03T12:12:12 comes after 0001-12-01T00:00:00.
The Where clause on the other hand implies that 2012-05-03T12:12:12 does not come after 0001-12-01T00:00:00, since the month 5>12 will be false.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 3 months
[Hibernate-JIRA] Created: (BVAL-214) Ability to validate an object and a list of changes
by Emmanuel Bernard (JIRA)
Ability to validate an object and a list of changes
---------------------------------------------------
Key: BVAL-214
URL: http://opensource.atlassian.com/projects/hibernate/browse/BVAL-214
Project: Bean Validation
Issue Type: Improvement
Reporter: Emmanuel Bernard
Pass a list of changes applied to an object graph and validate the object graph had the change been applied.
This is useful for presentation layers like JSF for cross field validations for example.
There are several possibilities to implement that:
1. pass in a Map<String,Object> with the list of changed properties
{code}validator.validateObject(Object model,Map<String,Object> newValues, Class ...profile){code}
2. pass in a set of more typesafe changedset but essentially the same as 1.
{code}changeSet.change("property", value).change("property2", null).remove("collection", index);
validator.validateObject(Object model,ChangeSet changeSet, Class ...profile){code}
3. pass a proxy of the object and apply changes to the proxy. One of the benefits of this approach is that it is transparent to the validator API. The drawback is that the object must be proxyable
{code}User proxiedUser = proxyfier.proxy(user);
proxiedUser.setName("Emmanuel");
proxiedUser.getAddresses().add(address);
validator.validateObject(Object proxiedUser, Class ...profile){code}
More info from Alex
{code} Client side validation already implemented in coming RichFaces 4.0 release, that's not a subject for bean validation. From the JSF side, the cool feature would be object validation that doesn't touch model itself. Currently, we can only validate a single bean attribute aganist new value, that doesn't allow. In richfaces, I do make a 'clone' of target object, update it with new values and perform validation on the cloned object. Would be nice to have something like: validator.validateObject(Object model,Map<String,Object> newValues, Class ...profile) that does a similar work.{code}
--
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....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 4 months
[Hibernate-JIRA] Created: (HHH-5376) Tests contain invalid SQL
by Fred Toussi (JIRA)
Tests contain invalid SQL
-------------------------
Key: HHH-5376
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5376
Project: Hibernate Core
Issue Type: Bug
Affects Versions: 3.5.x
Environment: Using HSQLDB 2.0.1 and Hibernate trunk (12 July 2010)
Reporter: Fred Toussi
These create table statements declare both primary key and unique constraints on the same set of columns. This is against the SQL standard and will fail with most databases.
public class DerivedIdentitySimpleParentSimpleDepTest extends TestCase {
22:52:06,265 ERROR SchemaExport:386 - Unsuccessful: create table MedicalHistory (lastupdate date, FK varchar(255) not null, primary key (FK), unique (FK))
22:52:06,265 ERROR SchemaExport:387 - a UNIQUE constraint already exists on the set of columns in statement [create table MedicalHistory (lastupdate date, FK varchar(255) not null, primary key (FK), unique (FK))]
public class DerivedIdentityIdClassParentSameIdTypeIdClassDepTest extends TestCase {
public void testOneToOneExplicitJoinColumn() throws Exception {
23:16:18,328 DEBUG SchemaExport:415 -
create table MedicalHistory (
FK1 varchar(255) not null,
FK2 varchar(255) not null,
primary key (FK1, FK2),
unique (FK1, FK2)
)
23:16:18,328 ERROR SchemaExport:386 - Unsuccessful: create table MedicalHistory (FK1 varchar(255) not null, FK2 varchar(255) not null, primary key (FK1, FK2), unique (FK1, FK2))
23:16:18,328 ERROR SchemaExport:387 - a UNIQUE constraint already exists on the set of columns in statement [create table MedicalHistory (FK1 varchar(255) not null, FK2 varchar(255) not null, primary key (FK1, FK2), unique (FK1, FK2))]
--
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....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 4 months