users@glassfish.java.net

Re: looks like another incorrect JPA QL -> SQL translation

From: Witold Szczerba <pljosh.mail_at_gmail.com>
Date: Tue, 10 Apr 2007 01:10:42 +0200

Few minutes ago I have downloaded NetBeans 5.5.1 RC1 and Sun Java
System Application Server 9.1 Beta (from Sun website).
I have recompiled, redeployed and... :) :) now it works, the
translated SQL looks like this:
DELETE FROM PROPOSALASSENT WHERE (PROPOSAL_ID = ?)

Hurray :)

2007/4/10, Witold Szczerba <pljosh.mail_at_gmail.com>:
> 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
>