|
Re: Query.executeUpdate() DELETE always returning 1 [message #639074 is a reply to message #639073] |
Mon, 15 November 2010 08:20 |
Ari Meyer Messages: 136 Registered: July 2009 |
Senior Member |
|
|
Sorry, I meant Query.executeUpdate(), not em.executeUpdate(). :-)
Ari
On 11/15/2010 12:15 AM, Ari Meyer wrote:
> Hi,
>
> I'm using EclipseLink 2.1.1 and Oracle JDBC driver 11.1.0.7.0 against
> Oracle 10.2.0.4.0.
>
> I have a simple bulk delete:
>
> <named-query name="deleteBudgetRsrcCurveForProjectId">
> <query>
> DELETE FROM BudgetRsrcCurve brc
> WHERE brc.projectId = :projectId
> AND brc.budgetType = :budgetType
> </query>
> </named-query>
>
>
> invoked:
> int numDeleted =
> _entityManager.createNamedQuery("deleteBudgetRsrcCurveForProjectId ")
> .setParameter("projectId", projectId)
> .setParameter("budgetType", BudgetType.CERTIFIED)
> .executeUpdate();
> _logger.debug("deleted {} BUDGET_RSRC_CURVE record(s)", numDeleted);
>
>
> log output:
> [2010-11-14 23:18:52,750] DEBUG
> mil.army.usace.p2.service.impl.BudgetServiceImpl deleted 1
> BUDGET_RSRC_CURVE record(s)
>
> It runs fine -- just deleted 485 records with my last successful test.
> Only strange thing is that executeUpdate() always is returning 1. Even
> for a case where there were no records to delete, it still returned 1.
> Javadoc says:
>
> int executeUpdate()
>
> Execute an update or delete statement.
>
> Returns:
> the number of entities updated or deleted
>
> Any ideas? I didn't find any reports of this on Google or the
> EclipseLink forum.
>
> Thanks,
> Ari
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03749 seconds