Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] Setting QueryHints.PARAMETER_DELIMITER doesn't work

I'm using glassfish 4.1 server along with eclipselink 2.6. Here is the example of the code I'm using:

String query = "SELECT [phone#], [fax#] FROM Test.dbo.customer WHERE id=1";
Query q = getEntityManager().createNativeQuery(query, "Customer.get");
q = q.setHint(QueryHints.PARAMETER_DELIMITER, "~");
List list = q.getResultList();

In the glassfish logs the query looks like setHint was never used:

SELECT [phone?, [fax? FROM Test.dbo.customer WHERE id=1

After I debugged the code I found the following. The field q.queryDelegate.databaseQuery holds reference to an instance of class ResultSetMappingQuery. Before the setHint method call another field q.queryDelegate.databaseQuery.queryMechanism.call.query holds reference to the same instance. But that's not the case after setHint. The first field now holds reference to a new instance of class ResultSetMappingQuery with correctly set parameter delimiter while the second field points to the old instance and that's exactly what's causing the issue. Do you know a workaround for that?

View this message in context: Setting QueryHints.PARAMETER_DELIMITER doesn't work
Sent from the EclipseLink - Users mailing list archive at Nabble.com.

Back to the top