Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] New QueryException in version 1.1

The issue seems to be that the Id of your CpTransaction is transaction-id but
your ManyToOne from CpMessage uses POLICY_NUMBER.  By default EclipseLink
assumes only the Id is used in delete queries and is trying to batch delete
the CpMessage objects using only the transaction-id.

If you could include the full exception stack trace to the error,

Exception Description: The parameter name [POLICY_NUMBER] in the query's
selection criteria does not match any parameter name defined in the query.
Query: DeleteObjectQuery(com.gmrc.jpa.domain.CpTransaction@e86eb5eb) 

I could confirm this.

A workaround is to set the CpTransaction DeleteObjectQuery to require the
full row using a DescriptorCustomizer,

descriptor.getQueryManager().setDeleteQuery(new DeleteObjectQuery());
descriptor.getQueryManager().getDeleteQuery().setIsFullRowRequired(true);

You could also change the Id of CpTransaction to POLICY_NUMBER, or change
the relationship to use transaction-id.

Please log a bug for this, as EclipseLink should auto-detect usage of a non
Id in the mapping and auto configure the descriptor to require the full
translation row.


Anything else I should look at for this?  I removed the association from
CpTransaction and then the delete works.  It has several other OnetoMany
associations and those get deleted as expected.
Why doesnt it list out the DeleteObjectQuery that it is having issues with?
Thanks


khaskett wrote:
> 
> I have not customized the delete query sql. 
> for CpTransaction looks like this --
>     entity = getEntityManager().getReference(CpTransaction.class,
> entity.getTransactionId());
>     getEntityManager().remove(entity);
> 
> for CpMsg it looks like -
>             entity = getEntityManager().getReference(CpMsg.class,
> entity.getMsgId());
>             getEntityManager().remove(entity);
> 
> Something I just noticed -- When it calls
> entityManager.delete(cpTransaction)  this seems to work
> as I get a delete successful message.   But the next statement calls
> entityManager.commit() which is when it fails with these log messages -
> [4/2/09 9:39:38:015 CDT] 00000036 SystemOut     O [EL Finer]: 2009-04-02
> 09:39:38.015--UnitOfWork(2091023522)--Thread(Thread[WebContainer :
> 3,5,main])--begin unit of work commit
> [4/2/09 9:39:38:015 CDT] 00000036 SystemOut     O [EL Finer]: 2009-04-02
> 09:39:38.015--ClientSession(246550194)--Connection(1484150902)--Thread(Thread[WebContainer
> : 3,5,main])--begin transaction
> [4/2/09 9:39:38:015 CDT] 00000036 SystemOut     O [EL Finest]: 2009-04-02
> 09:39:38.015--ClientSession(246550194)--Thread(Thread[WebContainer :
> 3,5,main])--reconnecting to external connection pool
> [4/2/09 9:39:38:031 CDT] 00000036 SystemOut     O [EL Finest]: 2009-04-02
> 09:39:38.031--UnitOfWork(2091023522)--Thread(Thread[WebContainer :
> 3,5,main])--Execute query
> DeleteObjectQuery(com.gmrc.jpa.domain.CpTransCoverage@13e013e0)
> [4/2/09 9:39:38:031 CDT] 00000036 SystemOut     O [EL Fine]: 2009-04-02
> 09:39:38.031--ClientSession(246550194)--Connection(1891922116)--Thread(Thread[WebContainer
> : 3,5,main])--DELETE FROM CP_SCHEDULED_ITEM WHERE (COVERAGE_ID = ?)
> 	bind => [1109268]
> [4/2/09 9:39:38:031 CDT] 00000036 SystemOut     O [EL Finest]: 2009-04-02
> 09:39:38.031--ClientSession(246550194)--Connection(1891922116)--Thread(Thread[WebContainer
> : 3,5,main])--[SQL0100] Row not found for DELETE.:02000 - null
> [4/2/09 9:39:38:046 CDT] 00000036 SystemOut     O [EL Fine]: 2009-04-02
> 09:39:38.046--ClientSession(246550194)--Connection(1891922116)--Thread(Thread[WebContainer
> : 3,5,main])--DELETE FROM CP_COVERAGE_DETAIL WHERE (COVERAGE_ID = ?)
> 	bind => [1109268]
> [4/2/09 9:39:38:062 CDT] 00000036 SystemOut     O [EL Finest]: 2009-04-02
> 09:39:38.062--ClientSession(246550194)--Connection(1891922116)--Thread(Thread[WebContainer
> : 3,5,main])--[SQL0100] Row not found for DELETE.:02000 - null
> [4/2/09 9:39:38:062 CDT] 00000036 SystemOut     O [EL Fine]: 2009-04-02
> 09:39:38.062--ClientSession(246550194)--Connection(1891922116)--Thread(Thread[WebContainer
> : 3,5,main])--DELETE FROM CP_COVERAGE WHERE (COVERAGE_ID = ?)
> 	bind => [1109268]
> [4/2/09 9:39:38:078 CDT] 00000036 SystemOut     O [EL Finest]: 2009-04-02
> 09:39:38.078--UnitOfWork(2091023522)--Thread(Thread[WebContainer :
> 3,5,main])--Execute query
> DeleteObjectQuery(com.gmrc.jpa.domain.CpTransaction@e86eb5eb)
> [4/2/09 9:39:38:078 CDT] 00000036 SystemOut     O [EL Finest]: 2009-04-02
> 09:39:38.078--UnitOfWork(2091023522)--Thread(Thread[WebContainer :
> 3,5,main])--Execute query
> DeleteObjectQuery(com.gmrc.jpa.domain.CpLob@4b764b76)
> [4/2/09 9:39:38:078 CDT] 00000036 SystemOut     O [EL Fine]: 2009-04-02
> 09:39:38.078--ClientSession(246550194)--Connection(1891922116)--Thread(Thread[WebContainer
> : 3,5,main])--DELETE FROM CP_INTEREST_LINK WHERE ((PARENT_ID = ?) AND
> (LINK_TYPE = P))
> 	bind => [26677]
> [4/2/09 9:39:38:093 CDT] 00000036 SystemOut     O [EL Finest]: 2009-04-02
> 09:39:38.093--ClientSession(246550194)--Connection(1891922116)--Thread(Thread[WebContainer
> : 3,5,main])--[SQL0100] Row not found for DELETE.:02000 - null
> [4/2/09 9:39:38:093 CDT] 00000036 SystemOut     O [EL Fine]: 2009-04-02
> 09:39:38.093--ClientSession(246550194)--Connection(1891922116)--Thread(Thread[WebContainer
> : 3,5,main])--DELETE FROM CP_LOB WHERE (LOB_ID = ?)
> 	bind => [26677]
> [4/2/09 9:39:38:109 CDT] 00000036 SystemOut     O [EL Warning]: 2009-04-02
> 09:39:38.109--UnitOfWork(2091023522)--Thread(Thread[WebContainer :
> 3,5,main])--Exception [EclipseLink-6094] (Eclipse Persistence Services -
> 1.1.0.r3634): org.eclipse.persistence.exceptions.QueryException
> Exception Description: The parameter name [POLICY_NUMBER] in the query's
> selection criteria does not match any parameter name defined in the query.
> Query: DeleteObjectQuery(com.gmrc.jpa.domain.CpTransaction@e86eb5eb)
> [4/2/09 9:39:38:109 CDT] 00000036 SystemOut     O [EL Finer]: 2009-04-02
> 09:39:38.109--ClientSession(246550194)--Connection(1891922116)--Thread(Thread[WebContainer
> : 3,5,main])--rollback transaction
> [4/2/09 9:39:38:125 CDT] 00000036 SystemOut     O [EL Finer]: 2009-04-02
> 09:39:38.125--UnitOfWork(2091023522)--Thread(Thread[WebContainer :
> 3,5,main])--release unit of work
> [4/2/09 9:39:38:125 CDT] 00000036 SystemOut     O [EL Finer]: 2009-04-02
> 09:39:38.125--ClientSession(246550194)--Thread(Thread[WebContainer :
> 3,5,main])--client released
> 


-----
---
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.eclipse.org/eclipselink/
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
TopLink 
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , 
http://wiki.oracle.com/page/TopLink TopLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
-- 
View this message in context: http://www.nabble.com/New-QueryException-in-version-1.1-tp22792539p23039947.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top