users@glassfish.java.net

looks like another incorrect JPA QL -> SQL translation

From: Witold Szczerba <pljosh.mail_at_gmail.com>
Date: Tue, 10 Apr 2007 00:15:30 +0200

Hi there,
few days ago I reported problem about incorrect (in my opinion) JPA QL
-> SQL translation, today I have found something else:

em.createQuery("DELETE FROM ProposalAssent p WHERE p.proposal = ?1")
.setParameter(1, proposalRef)
.executeUpdate();

And here is the exception thrown after executing:
[...]
Caused by: Exception [TOPLINK-4002] (Oracle TopLink Essentials -
2006.8 (Build 060830)):
oracle.toplink.essentials.exceptions.DatabaseException
Internal Exception: org.apache.derby.client.am.SqlException: Syntax
error: Encountered "=" at line 1, column 36.Error Code: -1
Call:DELETE FROM PROPOSALASSENT WHERE ( = ?)

Looks like something is missing in WHERE part of the statement :(
I have double checked my ProposalAssent entity bean:
//// cut
    @ManyToOne
    private Proposal proposal;
//// cut

And this is how it looks in Proposal entity:
//// cut
    @OneToMany(mappedBy = ProposalAssent.PROPOSAL, cascade=CascadeType.ALL)
    private List<ProposalAssent> assents;
//// cut