[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2434?page=c...
]
radhakrishna commented on HHH-2434:
-----------------------------------
I updated my MySql and Oracle java dialects using the latest SVN source code, compiled
them, and updated my hibernate3.jar with these class files respectively. When I run
seconds_between(date1,date2) method, both Oracle and MySql throw no data type for node
error in hibernate tools HQL editor. Am I missing something or do I need to update
anything else?
Oracle Exception stacktrace:
java.lang.IllegalStateException: No data type for node:
org.hibernate.hql.ast.tree.MethodNode
\-[METHOD_CALL] MethodNode: '('
+-[METHOD_NAME] IdentNode: 'seconds_between' {originalText=seconds_between}
\-[EXPR_LIST] SqlNode: 'exprList'
+-[DOT] DotNode: 'stockoptio0_.so_date'
{propertyName=soDate,dereferenceType=4,propertyPath=soDate,path=so.soDate,tableAlias=stockoptio0_,className=database.StockOption,classAlias=so}
| +-[ALIAS_REF] IdentNode: 'stockoptio0_.so_id' {alias=so,
className=database.StockOption, tableAlias=stockoptio0_}
| \-[IDENT] IdentNode: 'soDate' {originalText=soDate}
\-[DOT] DotNode: 'stockoptio0_.record_added_date_time'
{propertyName=recordAddedDate,dereferenceType=4,propertyPath=recordAddedDate,path=so.recordAddedDate,tableAlias=stockoptio0_,className=database.StockOption,classAlias=so}
+-[ALIAS_REF] IdentNode: 'stockoptio0_.so_id' {alias=so,
className=database.StockOption, tableAlias=stockoptio0_}
\-[IDENT] IdentNode: 'recordAddedDate' {originalText=recordAddedDate}
MySql Exception stacktrace:
java.lang.IllegalStateException: No data type for node:
org.hibernate.hql.ast.tree.MethodNode
\-[METHOD_CALL] MethodNode: '('
+-[METHOD_NAME] IdentNode: 'seconds_between' {originalText=seconds_between}
\-[EXPR_LIST] SqlNode: 'exprList'
+-[DOT] DotNode: 'stockoptio0_.so_date'
{propertyName=soDate,dereferenceType=4,propertyPath=soDate,path=so.soDate,tableAlias=stockoptio0_,className=database.StockOption,classAlias=so}
| +-[ALIAS_REF] IdentNode: 'stockoptio0_.so_id' {alias=so,
className=database.StockOption, tableAlias=stockoptio0_}
| \-[IDENT] IdentNode: 'soDate' {originalText=soDate}
\-[DOT] DotNode: 'stockoptio0_.record_added_date_time'
{propertyName=recordAddedDate,dereferenceType=4,propertyPath=recordAddedDate,path=so.recordAddedDate,tableAlias=stockoptio0_,className=database.StockOption,classAlias=so}
+-[ALIAS_REF] IdentNode: 'stockoptio0_.so_id' {alias=so,
className=database.StockOption, tableAlias=stockoptio0_}
\-[IDENT] IdentNode: 'recordAddedDate' {originalText=recordAddedDate}
I am able to run dialect specific methods with no issues for example I can run
datediff(date1, date2) when connected to my MySql database and run
months_difference(date1, date2) for Oracle dialect, however
Thanks a bunch
No standard way to calculate date intervals in HQL
--------------------------------------------------
Key: HHH-2434
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2434
Project: Hibernate Core
Issue Type: Improvement
Components: core
Affects Versions: 3.2.0.ga
Environment: All
Reporter: Don Smith
Priority: Minor
Attachments: HHH-2434.patch, hsqldb-stack.txt, IntervalTracker.java,
postgresql-stack.txt
Date interval calculation is supported differently on different database platforms. Some
allow direct arithmetic on columns, i.e. enddate - startdate. Some require functions,
datediff(), timestampdiff(), etc. This causes cross-platform issues. For instance, an
application I work on has to figure out the dialect that's in use (out of the four we
currently support) and create the HQL string differently for each platform. This is
undesirable, since we use Hibernate to enable platform neutrality; our installer asks
which database the customer wants to deploy to, and sets the dialect. We'd like our
codebase to be free of dialect-specific code.
I propose a standard solution for this, either direct date arithmetic, or a function
defintion that is ported across dialects. Timestampdiff seems to be a fairly standard
function, although DB2 has different syntax than MySQL and Derby. I've seen hints that
timestampdiff is part of the ANSI SQL standard, but do not have access to the documents to
determine if that is the case.
--
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