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

Noah -

Sorry about the slow reply I somehow missed it. If you set the  jdbc.batch-writing property does .executeUpdate() return the proper values?

Is there such a per query mechanism for controlling batch writing?
Sorry, but I don't know the answer to that. I don't have 2.3.x loaded up on my local system.

Thanks,
Rick

On Tue, Sep 16, 2014 at 8:58 AM, Noah White <emailnbw@xxxxxxxxx> wrote:
Rick,

Thanks for the pointer. The bug referenced in that thread appears marked as fixed for Eclipselink 2.5 which is great but won’t help my current environment. In any case I tried digging around the 2.5 documentation to see if the fix involves a query hint to turn off batch writing on a per query basis but it wasn’t clear to me. I found the jdbc.batch-writing property [1]


This seems to be a property vs a per query ‘hint’. Is there such a per query mechanism for controlling batch writing? 

-Noah

On Sep 16, 2014, at 9:06 AM, Rick Curtis <curtisr7@xxxxxxxxx> wrote:

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


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
_______________________________________________
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


_______________________________________________
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