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

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


-----
---
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-tp22792539p22826588.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top