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

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



Back to the top