[hibernate-issues] [Hibernate-JIRA] Created: (HHH-6523) no parentheses in SQL math operation with modulo and TSQL dialect

Rafał (JIRA) noreply at atlassian.com
Mon Aug 1 06:25:02 EDT 2011


no parentheses in SQL math operation with modulo and TSQL dialect
-----------------------------------------------------------------

                 Key: HHH-6523
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6523
             Project: Hibernate Core
          Issue Type: Bug
          Components: core
    Affects Versions: 3.6.4
            Reporter: Rafał


this fragment of JPA criteria:
qb.mod(
	qb.diff(
		qb.literal(1),
		qb.literal(2))
	),
	qb.literal(3)
),

generates proper HQL
	mod(1-2, 3)

which means
[A]	(1 - 2) % 3

but since TSQL supports '%' for modulo operation, generated sql is:
	1 - 2 % 3

modulo operator has higher priority, so this effectively means:
[B]	1 - (2 % 3)

problem is:
	[A] != [B]

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       



More information about the hibernate-issues mailing list