Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] Query.executeUpdate return value question

According to the Javadoc for Query.executeUpdate() [1] the int returned should reflect “the number of entities updated or deleted, however, when I run the following named query bulk update:

UPDATE Foo f SET f.bar=:bar, f.baz=:baz WHERE f.name=:name AND f.groupId=:groupId

Using the following:

public int bulkUpdate(int bar, int groupId, int baz, String name) {
Query query =
entityManager.createNamedQuery(Foo.bulkUpdate");
query.setParameter(name", name);
query.setParameter(groupId", groupId);
query.setParameter(bar", bar);
query.setParameter(baz", baz);
return query.executeUpdate();
}
I always get a 1 returned regardless of the fact that this query is updating > 1 rows. Why is this? I’m using Eclipselink 2.3.2v20111125-r10461 in Glassfish. The query is being executed in a CMT EJB.  

Thanks,

-Noah


Back to the top