users@glassfish.java.net

doubt about the support of TopLink Essentials for SQL Server

From: Zhao Jianyong <zhaojy_at_cn.fujitsu.com>
Date: Tue, 7 Oct 2008 17:28:59 +0800

Hi Peter
Hi GF) Dev Teams,
Hi Everyone,

I am doing some test about the support of TopLink Essentials for SQL Server.
Could you tell me whether TopLinkQueryHints.PESSIMISTIC_LOCK is supported
for SQL Server? Because I found some behavior of PESSIMISTIC_LOCK is not
correct.

============================================================================
Query q = em.createQuery("select p from Person p");
q.setHint(TopLinkQueryHints.PESSIMISTIC_LOCK, PessimisticLock.Lock);
============================================================================

When I want to get the ResultList by the above query,The SQL "SELECT ID,
NAME FROM PERSON FOR UPDATE" is sent to SQL Server.But this SQL is not
correct for SQL Server,and the below error would be got.

============================================================================
Exception in thread "main" JPA0020: Local Exception Stack:
Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.0.1 (Build SNAPSHOT
(09/08/2008))): oracle.toplink.essentials.exceptions.DatabaseException
Internal Exception: com.microsoft.sqlserver.jdbc.SQLServerException: Line 1:
FOR UPDATE clause allowed only for DECLARE CURSOR.
Error Code: 1003
Call: SELECT ID, NAME FROM PERSON FOR UPDATE
Query: ReportQuery(entity.Person)
===========================================================================

Need your help!
Could you give the answer or some message about the issue?

Best regards.
Zhao.