Skip to main content

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

Do you have batch writing enabled? If so, this link[1] might be helpful.

[1] http://www.eclipse.org/forums/index.php/t/200259/

On Fri, Sep 12, 2014 at 1:35 PM, Noah White <emailnbw@xxxxxxxxx> wrote:
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


_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/eclipselink-users



--
Rick Curtis

Back to the top