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

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
> 
> 
> 
> Here is the stack on delete-
> 
> James Sutherland wrote:
>> 
>> The error does not make any sense, as TRANSACTION_ID is the id of the
>> CpTransaction, not POLICY_NUMBER, the delete should only be using the
>> TRANSACTION_ID field.  Have you customized you delete query sql?
>> 
>> Please include the full exception stack trace.  Also include the finest
>> log for the entire transaction commit.  If it is too large, then isolate
>> the transaction to just deleting the one object.
>> 
>> 
>> 
>> khaskett wrote:
>>> 
>>> I will try to limit the parent entity to just relevant fields, as it is
>>> quite large -
>>> @Entity
>>> @Table(name = "CP_TRANSACTION")
>>> @Converter(name = "boolean", converterClass =
>>> com.gmrc.jpa.domain.mappings.converters.BooleanYNConverter.class)
>>> public class CpTransaction extends BaseDomain implements
>>> java.io.Serializable {
>>> 
>>>     private Set<CpMsg> cpMsgs = new HashSet<CpMsg>(0);
>>> ....
>>>     private String policyNumber;
>>> ....
>>>     private Long transactionId;
>>> ...
>>> 
>>> 
>>>     public boolean addCpMsg(final CpMsg cpMsg) {
>>>     	boolean retVal = false;
>>>         if (cpMsg != null) {
>>>         	if (this.cpMsgs == null) {
>>>                 this.cpMsgs = new HashSet<CpMsg>();
>>>             }
>>>             retVal = this.cpMsgs.add(cpMsg);
>>>             cpMsg.setCpTransaction(this);
>>>         }
>>>         return retVal;
>>>     }
>>> 
>>>     @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY,
>>> mappedBy = "cpTransaction")
>>>     @PrivateOwned
>>>     public Set<CpMsg> getCpMsgs() {
>>>         return this.cpMsgs;
>>>     }
>>> 
>>>     public void setCpMsgs(final Set<CpMsg> cpMsgs) {
>>>         this.cpMsgs = cpMsgs;
>>>     }
>>> 
>>>     @Column(name = "POLICY_NUMBER", length = 20)
>>>     public String getPolicyNumber() {
>>>         return this.policyNumber;
>>>     }
>>> 
>>>     public void setPolicyNumber(final String policyNumber) {
>>>         this.policyNumber = policyNumber;
>>>     }
>>> 
>>>     @Id
>>>     @GeneratedValue(strategy = GenerationType.IDENTITY)
>>>     @Column(name = "TRANSACTION_ID", unique = true, nullable = false,
>>> precision = 11, scale = 0)
>>>     public Long getTransactionId() {
>>>         return this.transactionId;
>>>     }
>>> 
>>>     public void setTransactionId(final Long transactionId) {
>>>         this.transactionId = transactionId;
>>>     }
>>> }
>>> 
>>> // This is the Child table
>>> @Entity
>>> @Table(name = "CP_MSG")
>>> public class CpMsg extends BaseDomain {
>>> 
>>>     private Long msgId;
>>>     private String policyNbr;
>>>     private Date msgTime;
>>>     private String msgType;
>>>     private String msgText;
>>>     private String userId;
>>>     private CpTransaction cpTransaction;
>>> 
>>>     @ManyToOne(fetch = FetchType.LAZY)
>>>     @JoinColumn(name = "POLICY_NBR", referencedColumnName =
>>> "POLICY_NUMBER", updatable = false, insertable = false)
>>>     public CpTransaction getCpTransaction() {
>>>         return this.cpTransaction;
>>>     }
>>> 
>>>     public void setCpTransaction(final CpTransaction cpTransaction) {
>>>         this.cpTransaction = cpTransaction;
>>>         
>>>         if (this.cpTransaction != null &&
>>> !this.cpTransaction.getCpMsgs().contains(this)) {
>>>         	this.cpTransaction.getCpMsgs().add(this);
>>>         	this.policyNbr = this.cpTransaction.getPolicyNumber();
>>>         }
>>>     }
>>> 
>>>     public CpMsg() {
>>>     }
>>> 
>>>     public CpMsg(final Long msgId, final Date msgTime, final String
>>> msgText) {
>>>         this.msgId = msgId;
>>>         this.msgTime = msgTime;
>>>         this.msgText = msgText;
>>>     }
>>> 
>>>     public CpMsg(final Long msgId, final String policyNbr, final String
>>> userId, final Date msgTime,
>>>             final String msgType, final String msgText) {
>>>         this.msgId = msgId;
>>>         this.policyNbr = policyNbr;
>>>         this.msgTime = msgTime;
>>>         this.msgType = msgType;
>>>         this.msgText = msgText;
>>>         this.userId = userId;
>>>     }
>>> 
>>>     @Id
>>>     @GeneratedValue(strategy = GenerationType.IDENTITY)
>>>     @Column(name = "MSG_ID", unique = true, nullable = false, precision
>>> = 11, scale = 0)
>>>     public Long getMsgId() {
>>>         return this.msgId;
>>>     }
>>> 
>>>     public void setMsgId(final Long msgId) {
>>>         this.msgId = msgId;
>>>     }
>>> 
>>>     @Column(name = "POLICY_NBR", length = 20)
>>>     public String getPolicyNbr() {
>>>         return this.policyNbr;
>>>     }
>>> 
>>>     public void setPolicyNbr(final String policyNbr) {
>>>         this.policyNbr = policyNbr;
>>>     }
>>> 
>>>     @Temporal(TemporalType.DATE)
>>>     @Column(name = "MSG_TIME", nullable = false, length = 26)
>>>     public Date getMsgTime() {
>>>         return this.msgTime;
>>>     }
>>> 
>>>     public void setMsgTime(final Date msgTime) {
>>>         this.msgTime = msgTime;
>>>     }
>>> 
>>>     @Column(name = "MSG_TYPE", length = 5)
>>>     public String getMsgType() {
>>>         return this.msgType;
>>>     }
>>> 
>>>     public void setMsgType(final String msgType) {
>>>         this.msgType = msgType;
>>>     }
>>> 
>>>     @Column(name = "MSG_TEXT", nullable = false)
>>>     public String getMsgText() {
>>>         return this.msgText;
>>>     }
>>> 
>>>     public void setMsgText(final String msgText) {
>>>         this.msgText = msgText;
>>>     }
>>> 
>>>     public void setUserId(final String userId) {
>>>         this.userId = userId;
>>>     }
>>> 
>>>     @Column(name = "USER_ID", nullable = false)
>>>     public String getUserId() {
>>>         return this.userId;
>>>     }
>>> 
>>>     @Override
>>>     public BaseDomain getParentDomain() {
>>>         // ParentDomain context not supported
>>>         return null;
>>>     }
>>> 
>>>     @Override
>>>     public CpActionCode getCpActionCode() {
>>>         // there is not associated action code
>>>         return null;
>>>     }
>>> 
>>>     @Override
>>>     @Transient
>>>     public long getId() {
>>>         return this.getMsgId();
>>>     }
>>> 
>>>     @Override
>>>     public void setId(long id) {
>>>         this.setMsgId(id);
>>>     }
>>> }
>>> 
>>> The full stack trace is pretty much as listed earlier. I will add the
>>> couple of statements before and after this error. I have logging set to
>>> FINEST right now.
>>> 
>>> [3/31/09 21:04:41:609 CDT] 0000003c SystemOut     O [EL Finest]:
>>> 2009-03-31
>>> 21:04:41.609--ClientSession(1163543898)--Connection(409213028)--Thread(Thread[WebContainer
>>> : 0,5,main])--[SQL0100] Row not found for DELETE.:02000 - null
>>> [3/31/09 21:04:41:640 CDT] 0000003c SystemOut     O [EL Fine]:
>>> 2009-03-31
>>> 21:04:41.64--ClientSession(1163543898)--Connection(409213028)--Thread(Thread[WebContainer
>>> : 0,5,main])--DELETE FROM CP_LOB WHERE (LOB_ID = ?)
>>> 	bind => [26589]
>>> [3/31/09 21:04:41:796 CDT] 0000003c SystemOut     O [EL Warning]:
>>> 2009-03-31
>>> 21:04:41.781--UnitOfWork(494673276)--Thread(Thread[WebContainer :
>>> 0,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@de21fdeb)
>>> [3/31/09 21:04:41:796 CDT] 0000003c SystemOut     O [EL Finer]:
>>> 2009-03-31
>>> 21:04:41.796--ClientSession(1163543898)--Connection(409213028)--Thread(Thread[WebContainer
>>> : 0,5,main])--rollback transaction
>>> [3/31/09 21:04:41:859 CDT] 0000003c SystemOut     O [EL Finer]:
>>> 2009-03-31
>>> 21:04:41.859--UnitOfWork(494673276)--Thread(Thread[WebContainer :
>>> 0,5,main])--release unit of work
>>> [3/31/09 21:04:41:859 CDT] 0000003c SystemOut     O [EL Finer]:
>>> 2009-03-31
>>> 21:04:41.859--ClientSession(1163543898)--Thread(Thread[WebContainer :
>>> 0,5,main])--client released
>>> 
>>> The id of the CpTransaction object is not null, it is 31840.
>>> As there are multiple child tables to CpTransaction the full stack is
>>> quite large also.. but here is a snippet where it first does a read on
>>> CpMsg
>>> [3/31/09 21:04:40:250 CDT] 0000003c SystemOut     O [EL Finest]:
>>> 2009-03-31
>>> 21:04:40.25--ServerSession(1388466882)--Thread(Thread[WebContainer :
>>> 0,5,main])--Execute query ReadAllQuery(name="cpMsgs"
>>> referenceClass=CpMsg sql="SELECT MSG_ID, MSG_TEXT, MSG_TYPE, MSG_TIME,
>>> USER_ID, POLICY_NBR FROM CP_MSG WHERE (POLICY_NBR = ?)")
>>> [3/31/09 21:04:40:250 CDT] 0000003c SystemOut     O [EL Finest]:
>>> 2009-03-31
>>> 21:04:40.25--ServerSession(1388466882)--Thread(Thread[WebContainer :
>>> 0,5,main])--reconnecting to external connection pool
>>> [3/31/09 21:04:40:250 CDT] 0000003c SystemOut     O [EL Fine]:
>>> 2009-03-31
>>> 21:04:40.25--ServerSession(1388466882)--Connection(307630678)--Thread(Thread[WebContainer
>>> : 0,5,main])--SELECT MSG_ID, MSG_TEXT, MSG_TYPE, MSG_TIME, USER_ID,
>>> POLICY_NBR FROM CP_MSG WHERE (POLICY_NBR = ?)
>>> 	bind => [0000431908]
>>> 
>>> And the POLICY_NBR is correct.
>>> 
>>> Let me know if there is anything else 
>>> 
>>> 
>>> James Sutherland wrote:
>>>> 
>>>> That is odd, in the CpTransaction object that you are deleting, what is
>>>> the value of its id, is it null?  What is its Id, policyNumber is not
>>>> marked as the id?  Please include the  complete mappings for this class
>>>> and the full exception stack trace.
>>>> 
>>>> 
>>>> 
>>>> khaskett wrote:
>>>>> 
>>>>> I removed the @JoinColumn as suggested but I still get the same error
>>>>> -
>>>>> [3/31/09 20:28:00:437 CDT] 00000035 SystemOut     O [EL Warning]:
>>>>> 2009-03-31
>>>>> 20:28:00.421--UnitOfWork(2109111734)--Thread(Thread[WebContainer :
>>>>> 0,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@de21fdeb)
>>>>> 
>>>>> Anything else I might try?
>>>>> Thanks
>>>>> 
>>>>> 
>>>>> James Sutherland wrote:
>>>>>> 
>>>>>> I'm not exactly sure, but my guess is it has something to do with
>>>>>> the,
>>>>>> 
>>>>>> @JoinColumn(name = "POLICY_NUMBER", referencedColumnName =
>>>>>> "POLICY_NBR") 
>>>>>> 
>>>>>> Annotation in your @OneToMany mapping.  In JPA 1.0 using a
>>>>>> @JoinColumn in a @OneToMany was not supported.  However in JPA 2.0 it
>>>>>> will be, and is in EclipseLink 1.1.  Because you are using a mappedBy
>>>>>> in your mapping though, you should not have the @JoinColumn, so you
>>>>>> should remove it.
>>>>>> 
>>>>>> 
>>>>>> khaskett wrote:
>>>>>>> 
>>>>>>> Is there a way to figure out why I am getting a QueryException in a
>>>>>>> delete request?
>>>>>>> [3/30/09 14:47:35:328 CDT] 0000003f SystemOut     O [EL Warning]:
>>>>>>> 2009-03-30
>>>>>>> 14:47:35.328--UnitOfWork(2104393070)--Thread(Thread[WebContainer :
>>>>>>> 5,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@de21fdeb)
>>>>>>> 
>>>>>>> I was not seeing this in the 1.0.2 version.
>>>>>>> 
>>>>>>> I have narrowed it down to the relationship between these two
>>>>>>> entities.
>>>>>>> 
>>>>>>> @Entity
>>>>>>> @Table(name = "CP_TRANSACTION")
>>>>>>> public class CpTransaction extends BaseDomain implements
>>>>>>> java.io.Serializable {
>>>>>>> ....
>>>>>>>     private Set<CpMsg> cpMsgs = new HashSet<CpMsg>(0);
>>>>>>> ....
>>>>>>>     @OneToMany(fetch = FetchType.LAZY, mappedBy = "cpTransaction")
>>>>>>>     @JoinColumn(name = "POLICY_NUMBER", referencedColumnName =
>>>>>>> "POLICY_NBR")
>>>>>>>     @PrivateOwned
>>>>>>>     public Set<CpMsg> getCpMsgs() {
>>>>>>>         return this.cpMsgs;
>>>>>>>     }
>>>>>>> 
>>>>>>>     @Column(name = "POLICY_NUMBER", length = 20)
>>>>>>>     public String getPolicyNumber() {
>>>>>>>         return this.policyNumber;
>>>>>>>     }
>>>>>>> }
>>>>>>> 
>>>>>>> @Entity
>>>>>>> @Table(name = "CP_MSG")
>>>>>>> public class CpMsg extends BaseDomain {
>>>>>>>     private Long msgId;
>>>>>>> .....
>>>>>>>     private String policyNbr;
>>>>>>>     private CpTransaction cpTransaction;
>>>>>>> 
>>>>>>>     @ManyToOne(fetch = FetchType.LAZY)
>>>>>>>     @JoinColumn(name = "POLICY_NBR", referencedColumnName =
>>>>>>> "POLICY_NUMBER", updatable = false, insertable = false)
>>>>>>>     public CpTransaction getCpTransaction() {
>>>>>>>         return this.cpTransaction;
>>>>>>>     }
>>>>>>> 
>>>>>>>     @Id
>>>>>>>     @GeneratedValue(strategy = GenerationType.IDENTITY)
>>>>>>>     @Column(name = "MSG_ID", unique = true, nullable = false,
>>>>>>> precision = 11, scale = 0)
>>>>>>>     public Long getMsgId() {
>>>>>>>         return this.msgId;
>>>>>>>     }
>>>>>>>     
>>>>>>>     @Column(name = "POLICY_NBR", length = 20)
>>>>>>>     public String getPolicyNbr() {
>>>>>>>         return this.policyNbr;
>>>>>>>     }
>>>>>>> }
>>>>>>> 
>>>>>>> The SQL relationship is CP_TRANSACTION.POLICY_NUMBER =
>>>>>>> CP_MSG.POLICY_NBR.
>>>>>>> 
>>>>>>> If I do a getCpMsgs() it seems to find them correctly.
>>>>>>> 
>>>>>>> Thanks
>>>>>>> Kevin
>>>>>>> 
>>>>>> 
>>>>>> 
>>>>> 
>>>>> 
>>>> 
>>>> 
>>> 
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/New-QueryException-in-version-1.1-tp22792539p22990227.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top