From: <no...@at...> - 2005-03-01 07:43:06
|
Message: A new issue has been created in JIRA. --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/browse/HHH-160 Here is an overview of the issue: --------------------------------------------------------------------- Key: HHH-160 Summary: New query parser does not allow bitwise operations Type: Bug Status: Unassigned Priority: Major Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: Hibernate3 Components: core Versions: 3.0 rc 1 Assignee: Reporter: Markus Jessenitschnig Created: Tue, 1 Mar 2005 1:42 AM Updated: Tue, 1 Mar 2005 1:42 AM Environment: Hibernate 3.0 rc1, MySQL Description: The new query parser does not allow bitwise operations like bitwise-and and bitwise-or. Example: SELECT FIRSTNAME, SURNAME FROM EMPLOYEE WHERE (STATUS & 1) > 0 The Exception is: org.hibernate.QueryException: unexpected char: '&' --------------------------------------------------------------------- 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 |
From: <no...@at...> - 2005-03-18 04:52:00
|
The following issue has been updated: Updater: Gavin King (mailto:ga...@hi...) Date: Thu, 17 Mar 2005 10:49 PM Comment: A workaround is to define a SQLFunctionTemplate on a Dialect subclass Changes: type changed from Bug to Improvement priority changed from Major to Minor --------------------------------------------------------------------- For a full history of the issue, see: http://opensource.atlassian.com/projects/hibernate/browse/HHH-160?page=history --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/browse/HHH-160 Here is an overview of the issue: --------------------------------------------------------------------- Key: HHH-160 Summary: New query parser does not allow bitwise operations Type: Improvement Status: Unassigned Priority: Minor Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: Hibernate3 Components: core Versions: 3.0 rc 1 Assignee: Reporter: Markus Jessenitschnig Created: Tue, 1 Mar 2005 1:42 AM Updated: Thu, 17 Mar 2005 10:49 PM Environment: Hibernate 3.0 rc1, MySQL Description: The new query parser does not allow bitwise operations like bitwise-and and bitwise-or. Example: SELECT FIRSTNAME, SURNAME FROM EMPLOYEE WHERE (STATUS & 1) > 0 The Exception is: org.hibernate.QueryException: unexpected char: '&' --------------------------------------------------------------------- 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 |
From: Daniele G. (JIRA) <no...@at...> - 2006-05-25 16:28:27
|
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-160?page=comments#action_23162 ] Daniele Gariboldi commented on HHH-160: --------------------------------------- I need this function too (masking permission and quering for permitted objects in one shot). Why it can't be standardize through all the dialect ? It's just a scalar function, could be andbit(a,b) and so on (orbit , xorbit). bit_or is another function in postgresql, of type aggregate, thus my covention. > New query parser does not allow bitwise operations > -------------------------------------------------- > > Key: HHH-160 > URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-160 > Project: Hibernate3 > Type: Improvement > Components: core > Versions: 3.0 rc 1 > Environment: Hibernate 3.0 rc1, MySQL > Reporter: Markus Jessenitschnig > Priority: Minor > > > The new query parser does not allow bitwise operations like bitwise-and and bitwise-or. > Example: > SELECT FIRSTNAME, SURNAME FROM EMPLOYEE WHERE (STATUS & 1) > 0 > The Exception is: > org.hibernate.QueryException: unexpected char: '&' -- 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 - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: Max R. A. (JIRA) <no...@at...> - 2006-05-25 16:38:14
|
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-160?page=comments#action_23163 ] Max Rydahl Andersen commented on HHH-160: ----------------------------------------- it can be standardized through the dialect just like Gavin wrote. > New query parser does not allow bitwise operations > -------------------------------------------------- > > Key: HHH-160 > URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-160 > Project: Hibernate3 > Type: Improvement > Components: core > Versions: 3.0 rc 1 > Environment: Hibernate 3.0 rc1, MySQL > Reporter: Markus Jessenitschnig > Priority: Minor > > > The new query parser does not allow bitwise operations like bitwise-and and bitwise-or. > Example: > SELECT FIRSTNAME, SURNAME FROM EMPLOYEE WHERE (STATUS & 1) > 0 > The Exception is: > org.hibernate.QueryException: unexpected char: '&' -- 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 - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: Daniele G. (JIRA) <no...@at...> - 2006-05-27 11:57:17
|
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-160?page=comments#action_23171 ] Daniele Gariboldi commented on HHH-160: --------------------------------------- I vote for one standard naming convention for bitwise functions in Hibernate distribution standard dialects. Here is how I implement bitwise function (and aggregate bitwise functions found in group by clause) for PostgreSQL 8.1, hibernate 3.1.2. Thank you for your work, hibernate community. import java.util.List; import org.hibernate.Hibernate; import org.hibernate.QueryException; import org.hibernate.dialect.function.SQLFunction; import org.hibernate.dialect.function.SQLFunctionTemplate; import org.hibernate.engine.Mapping; import org.hibernate.engine.SessionFactoryImplementor; import org.hibernate.type.Type; /** * Implements bitwise varargs (max 4) functions for PostgreSQL. Overload bit_and * and bit_or functions using 1 arg as aggreagate bitwise function. */ public class PostgreSQLDialect extends org.hibernate.dialect.PostgreSQLDialect { public PostgreSQLDialect() { super(); registerFunction("bit_and", new SQLFunctionTemplates(Hibernate.INTEGER, "bit_and(?1)", "?1 & ?2 & ?3 & ?4")); registerFunction("bit_not", new SQLFunctionTemplate(Hibernate.INTEGER, "~?1")); registerFunction("bit_or", new SQLFunctionTemplates(Hibernate.INTEGER, "bit_or(?1)", "?1 & ?2 & ?3 & ?4")); } public static class SQLFunctionTemplates implements SQLFunction { private SQLFunctionTemplate template1arg; private SQLFunctionTemplate templateNarg; public SQLFunctionTemplates(Type type, String template1arg, String templateNarg) { this.template1arg = new SQLFunctionTemplate(type, template1arg); this.templateNarg = new SQLFunctionTemplate(type, templateNarg); } private SQLFunctionTemplate getSQLFunctionTemplate(List args) { if (args.size() == 1) return template1arg; return templateNarg; } public Type getReturnType(Type columnType, Mapping mapping) throws QueryException { return template1arg.getReturnType(columnType, mapping); } public boolean hasArguments() { return true; } public boolean hasParenthesesIfNoArguments() { return true; } public String render(List args, SessionFactoryImplementor factory) throws QueryException { return getSQLFunctionTemplate(args).render(args, factory); } } } > New query parser does not allow bitwise operations > -------------------------------------------------- > > Key: HHH-160 > URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-160 > Project: Hibernate3 > Type: Improvement > Components: core > Versions: 3.0 rc 1 > Environment: Hibernate 3.0 rc1, MySQL > Reporter: Markus Jessenitschnig > Priority: Minor > > > The new query parser does not allow bitwise operations like bitwise-and and bitwise-or. > Example: > SELECT FIRSTNAME, SURNAME FROM EMPLOYEE WHERE (STATUS & 1) > 0 > The Exception is: > org.hibernate.QueryException: unexpected char: '&' -- 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 - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: Daniele G. (JIRA) <no...@at...> - 2006-05-27 12:02:12
|
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-160?page=comments#action_23172 ] Daniele Gariboldi commented on HHH-160: --------------------------------------- Sorry, error in bit_or function. Here is the right line: (copied and pasted without changing & with |). registerFunction("bit_or", new SQLFunctionTemplates(Hibernate.INTEGER, "bit_or(?1)", "?1 | ?2 | ?3 | ?4")); > New query parser does not allow bitwise operations > -------------------------------------------------- > > Key: HHH-160 > URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-160 > Project: Hibernate3 > Type: Improvement > Components: core > Versions: 3.0 rc 1 > Environment: Hibernate 3.0 rc1, MySQL > Reporter: Markus Jessenitschnig > Priority: Minor > > > The new query parser does not allow bitwise operations like bitwise-and and bitwise-or. > Example: > SELECT FIRSTNAME, SURNAME FROM EMPLOYEE WHERE (STATUS & 1) > 0 > The Exception is: > org.hibernate.QueryException: unexpected char: '&' -- 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 - For more information on JIRA, see: http://www.atlassian.com/software/jira |