From: <leg...@at...> - 2003-11-03 10:13:14
|
The following comment has been added to this issue: Author: Michail Jekimov Created: Mon, 3 Nov 2003 4:12 AM Body: Hello Gavin, I tried to register my PL/SQL function by subclassing the OracleDialect in the following way: public class MyDatabaseDialect extends OracleDialect { public MyDatabaseDialect() { super(); registerFunction("get_price", new SQLFunction() { public Type getReturnType(Type columnType, Mapping mapping) { return Hibernate.INTEGER; } public boolean hasArguments() { return true; } public boolean hasParenthesesIfNoArguments() { return true; } }); } } When I try to execute a query with this function, Hibernate throws the following: net.sf.hibernate.QueryException: alias or expression expected in SELECT [ select min( get_price(stockItem.id, 1.0)) from StockItem stockItem where stockItem.stock.id = ?] at net.sf.hibernate.hql.SelectParser.token(SelectParser.java:74) at net.sf.hibernate.hql.ClauseParser.token(ClauseParser.java:87) at net.sf.hibernate.hql.ClauseParser.end(ClauseParser.java:114) at net.sf.hibernate.hql.PreprocessingParser.end(PreprocessingParser.java:143) at net.sf.hibernate.hql.ParserHelper.parse(ParserHelper.java:30) When I register a function that needs only one parameter everything works fine. But I really need to pass more than one parameter to it. Is it a wrong way to define my own SQL functions? --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-158 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-158 Summary: Customizable SQL Type: New Feature Status: Unassigned Priority: Major Project: Hibernate2 Components: core Versions: 2.0.1 Assignee: Reporter: TURIN ACCOUNT Created: Tue, 8 Jul 2003 3:38 PM Updated: Tue, 8 Jul 2003 3:38 PM Description: Ability to be able to get the SQL Hibernate would send to the database for a given query, be able to look at it and possibly tweak it (as a String) and then allow Hibernate to continue - sending the SQL on its way to the database. This allows for subtle hints and other database tricks one is often forced to do when you don't "own" the datamodel. --------------------------------------------------------------------- JIRA INFORMATION: 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 If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |