Oracle9Dialect registers last_day() function as "lastday"

Description

Oracle9Dialect.java registers a "lastday" function, however the actual Oracle function is last_day() (with the underscore). This results in a SQL error if the function is used in HQL (and obviously, HQL will not accept use of "last_day").

The patch is basically:

- registerFunction( "lastday", new StandardSQLFunction("lastday", Hibernate.DATE) );
+ registerFunction( "last_day", new StandardSQLFunction("last_day", Hibernate.DATE) );

or, if support for the incorrect "lastday" usage should still be supported:

- registerFunction( "lastday", new StandardSQLFunction("lastday", Hibernate.DATE) );
+ registerFunction( "last_day", new StandardSQLFunction("last_day", Hibernate.DATE) );
+ registerFunction( "lastday", new StandardSQLFunction("last_day", Hibernate.DATE) );

Both patch options are attached.

Environment

Hibernate 2.x, 3.x with an Oracle database

Activity

Show:
Ben Turner
November 5, 2007, 6:15 PM

Can still produce in 3.2.3 - patch looks simple, would be good to see this assigned and fixed ?

Diego Plentz
November 6, 2007, 4:10 AM

I changed it in Oracle9Dialect and Oracle8iDialect. I just change the lines, because it won't work anyway if anybody used as it was.

References:
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions072.htm
http://download-uk.oracle.com/docs/cd/B10501_01/server.920/a96540/functions58a.htm

Fixed in trunk/3.2.6

Steve Ebersole
March 21, 2011, 7:05 PM

Bulk closing stale resolved issues

Assignee

Diego Plentz

Reporter

Carl Lindberg

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Minor
Configure