This is a SQL Server DB and the developer, many years ago, made a column name for boolean values contain a ?
character. Many systems access this DB, so changing this column name isn't really an option for me.
This works in native MS tools:
SELECT * FROM MyDatabase.dbo.[My Table] WHERE [Active?]= true
That same query fails in a session.createSQLQuery
with Hibernate throwing an error attempting to interpret the ?
inside the bracketed field name as a parameter.
I've tried backticks [Active?\
]
I've tried escaping with /! [Active/!?] and vice versa !/ [Active!/?] with no effect.
I've also looked around quite a few stack overflow and web forums for other suggestions but the other things I've tried have not worked.
Is this a bug in hibernate? It seems to me that nothing in brackets should be interpretable as parameters.
The specific error is a query exception
> Expected positional parameter count: 1, actual parameters:[]
with the query string attached.
joachim-isaksson Answered it: [Active\\?]
is it
@joachim-isaksson Answered it [Active\\?]