[
https://issues.apache.org/jira/browse/OPENJPA-1748?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12893203#action_12893203
]
Michel Ganguin commented on OPENJPA-1748:
-----------------------------------------
the code above fails at entityManager.find().
but entityManager.remove() fails too when entity is retrieved with a
entityManager.getSingleResutl("SELECT...")
> delete error when using constant joins with fetchtype lazy
> ----------------------------------------------------------
>
> Key: OPENJPA-1748
> URL: https://issues.apache.org/jira/browse/OPENJPA-1748
> Project: OpenJPA
> Issue Type: Bug
> Affects Versions: 1.2.1
> Environment: - windows glassfish/mysql
> - linux glassfish/mysql
> - linux weblogic/oracle
> Reporter: Michel Ganguin
> Priority: Critical
>
> 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]
> as workaround it works without errors if I change fetchtype to eager, but in
> my case this could have a great performance overhead.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.