HqlSqlWalker transforms two same HQL-Query-trees with "java.util.Date" attribute casted as "date" different.

Description

Hi,
we have two classes with same attribute "Date modifiedDate".

Example Query:
OK: SELECT name FROM Company entity WHERE CAST(entity.modifiedDate AS date) != current_date()
ERROR: SELECT name FROM Holiday entity WHERE CAST(entity.modifiedDate AS date) != current_date()

Executing the above HQL-queries results in different AST-Nodes for the WHERE clause,
see the two appended AST_LOG files with the node trees
(line 50 in ASTNodeDump_ObjectHoliday marked by me as ERROR).

There is a DotNode instead of an IdentNode in AST_LOG for "java.util.Date" attribute casted as "date".

Where is the differenz?

Thanks, Thomas Quathamer

Environment

Eclipse, PostgreSQL DB Server 8.3,
Hibernate Annotations 3.4.0.ga,
Hibernate Commons-Annotations-3.4.0.ga,
Hibernate Core-3.3.1.ga,
Hibernate EntityManager 3.4.0.ga
Hibernate Search 3.1.0.ga
Hibernate Validator 3.1.0.ga

Activity

Show:
Strong Liu
September 1, 2010, 12:24 PM

please take a look of the javadoc of javax.persistence.Temporal, and let me know if this helps, thanks

Steve Ebersole
September 1, 2010, 1:25 PM

Maybe you could upload a non-windows-only zip format?

DanielD
September 1, 2010, 9:52 PM

Converted the attachment to a more common zip format.

DanielD
September 1, 2010, 9:58 PM

I looked at javax.persistence.Temporal, but the error still occurs. Just kidding, but we want to map that as Timestamp and not as date, and in the above clause we cast to date for a "today" filter.

DanielD
September 1, 2010, 11:10 PM

Further investigation revealed a minor detail that might be of importance for this issue: The Entity "holiday" contains another attribute with the name "date"! When we renamed that attribute to confirm the relation to the problem, the error disappeard.

Out of Date

Assignee

Unassigned

Reporter

Thomas Quathamer

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major