openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pinaki Poddar (JIRA)" <j...@apache.org>
Subject [jira] Commented: (OPENJPA-692) Bi-directional One-to-Many mapping with a JoinTable fails for Update or Delete operation
Date Mon, 11 Aug 2008 06:33:44 GMT

    [ https://issues.apache.org/jira/browse/OPENJPA-692?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12621361#action_12621361
] 

Pinaki Poddar commented on OPENJPA-692:
---------------------------------------

With SVN Commit 68442, OpenJPA addresses the bi-directional mapping with a JoinTable when
mapping is annotated is two independent mappings at both ends of the relationship i.e. no
'mappedBy' attribute links the two ends.
Can you try that mapping with these latest changes to let us know whether that works for you?
I have tested them and the check-in test cases are available with revision 68443.

The other variants you have mentioned with @SecondaryTable annotations need to be tested with
OpenJPA. 

> Bi-directional One-to-Many mapping with a JoinTable fails for Update or Delete operation
> ----------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-692
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-692
>             Project: OpenJPA
>          Issue Type: Bug
>            Reporter: Pinaki Poddar
>            Assignee: Pinaki Poddar
>             Fix For: 1.3.0
>
>
> Originally reported in user group message [1] by Frank Schwarz 
> If
> a) Entities A and B that are related in a one-to-many and many-to-one bi-directional
relation (typical Parent-Child pattern)
> b) mapped using a JoinTable instead of conventional mappedBy 
> then
> update/delete operation fails with OptimisticException (which itself is a catch-all and
sometimes misleading). 
> Typical mapping that encounters this error:
> public class Person {
> 	@Id
> 	private long ssn;
> 	
> 	@OneToMany(cascade=CascadeType.ALL)
> 	@JoinTable(name="J_PERSON_ADDRESSES",
> 			joinColumns               = @JoinColumn(name="PERSON_SSN",    referencedColumnName="SSN"),
> 			inverseJoinColumns = @JoinColumn(name="ADDRESS_PHONE", referencedColumnName="PHONE"))
>     private Set<Address> addresses = new HashSet<Address>();
> public class Address {
>    @Id
>    private String phone;
> 	
>     @ManyToOne
>     @JoinColumn(table="J_PERSON_ADDRESSES", referencedColumnName="SSN")
>     private Person person;
> [1] http://n2.nabble.com/bidirectional-one-to-many-relationship-with-join-table-tc678479.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message