You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Michel Ganguin <ga...@gmail.com> on 2010/07/22 11:26:47 UTC

delete error when using constant joins

In openjpa version 1.2.1

Entity (fetch lazy, without cascade):

@Entity
@Table(name="Table1")
public class Table1  {

    @ManyToOne(optional = true, fetch = FetchType.LAZY)
    @JoinColumns({
        @JoinColumn(name="FK" referencedColumnName="PK1"),
        @JoinColumn(name="Table2.PK2" referencedColumnName="'a'")
    });
    private Table2 table2;
}

I want to remove an entry:

Table1 t1 = entityManager.find(Table1.class, "table1Key");
entityManager.remove(t1);

but this raises an exception because the parameter 'a' (from
referencedColumnName) is missing.

org.apache.openjpa.persistence.PersistenceException: No value specified for
parameter 2. {prepstmnt 1615708154 SELECT t1.* FROM Table1 t0 INNER JOIN
Table2 t1 ON t0.FK = t1.PK1 AND ? = t1.PK2 WHERE t0.PK = ? [params=(String)
table1Key]} [code=0, state=22023]

it works without errors if I change fetchtype to eager. Did I something
wrong? is it an openjpa bug?
-- 
View this message in context: http://openjpa.208410.n2.nabble.com/delete-error-when-using-constant-joins-tp5324637p5324637.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: delete error when using constant joins

Posted by Pinaki Poddar <pp...@apache.org>.
> it works without errors if I change fetchtype to eager.
> is it an openjpa bug? 

Quite likely. Please file a JIRA issue.

-----
Pinaki 
-- 
View this message in context: http://openjpa.208410.n2.nabble.com/delete-error-when-using-constant-joins-tp5324637p5342399.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.