Illegal attempt to set lock mode on a non-SELECT query for Named Update Query

Description

If I try to execute a NamedQuery with a subselect I get the exception in the subject line. Note that this same code base worked fine on 4.2.8.Final. Here's an example query that will give you this exception:

@NamedQuery(
name = "Contact.updateBlocked",
query = "UPDATE ContactEntity SET blocked = true WHERE " +
"id IN :ids OR " +
"(owner.id = :ownerId AND " +
"user != null and user IN ( SELECT c1.user " +
"FROM ContactEntity c1 WHERE c1.id IN (:ids)))" ),

If there is no sub-select the query works. This worked fine in 4.2.8.Final.

Activity

Robert DiFalcoJanuary 2, 2014 at 12:01 AM

Anyone look at this yet? It seems like a HUGE bug. You can no longer run an JPL UPDATE in a NamedQuery.

Robert DiFalcoDecember 24, 2013 at 12:35 AM

Now that I try some tests this seems to be an issue with ANY NamedQuery that contains an update query. But really, could something this major have been missed or is there some subtle weirdness in my environment? I am also using Spring 4.0.

Duplicate

Details

Assignee

Reporter

Affects versions

Priority

Created December 24, 2013 at 12:11 AM
Updated January 2, 2014 at 3:06 PM
Resolved January 2, 2014 at 3:06 PM

Flag notifications