JDBC Escape Sequences do not work in named native sql queries -
I tried to used JDBC Escape Sequences in a named SQL query, it appears that Hibernate assumes braces i.e '{' and '}' as Alias names and an exception is thrown.
This is the Query which tried using SQL Server dialect -
SELECT CategoryService.ServiceID as {SearchResults.ServiceID},
CategoryService.Name as {SearchResults.Title},
CategoryService.Description as {SearchResults.Summary},
CategoryService.DocumentID as {SearchResults.DocumentID}
FROM {oj DefArea LEFT OUTER JOIN DefService CategoryService
LEFT OUTER JOIN DefCategoryServices
LEFT OUTER JOIN DefCategory ON
DefCategoryServices.CategoryID = DefCategory.CategoryID ON
CategoryService.ServiceID = DefCategoryServices.ServiceID ON
DefArea.AreaID = CategoryService.AreaID}
WHERE (CategoryService.IsSpecialOrder = 0 or DefArea.HasSpecialOrder = 1) AND
(CategoryService.AreaID in (2, 1, 3)) AND
(CategoryService.IsInactive = 0) and
(({fn UCASE(DefCategory.Name)} LIKE {fn UCASE(:SearchString)}) OR
({fn UCASE(CategoryService.Name)} LIKE {fn UCASE(:SearchString)}) OR
({fn UCASE(CategoryService.Description)} LIKE {fn UCASE(:SearchString)}))
Kishore
|