openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pinaki Poddar <ppod...@apache.org>
Subject RE: bidirectional one-to-many relationship with join-table
Date Tue, 08 Jun 2010 03:28:04 GMT

Hi,
  1. what is the settings for openjpa.jdbc.SynchronizeMappings property?
  2. is there an existing schema?
  
I ran your example as it is to define the schema on a MySQL databse.
It ended up with three columns on PERSON_ADDRESSES join table
   CREATE TABLE person_addresses (
      ADDRESS_PHONE VARCHAR(255), 
      PERSON_SSN BIGINT, 
      phone VARCHAR(255))

Quite possibly a bug.

Editing line 03 of your mapping spec 

01: @JoinTable(name="person_addresses",
02:      joinColumns = @JoinColumn(name="person_ssn",
referencedColumnName="ssn"),
03:       inverseJoinColumns = @JoinColumn(name="phone",
referencedColumnName="phone")) 

Edit line 03 to
   inverseJoinColumns = @JoinColumn(name="address_phone",
referencedColumnName="phone")) 

Got rid of the third column on the join table.
But obviously naming of join table's columns has a problem that requires
further investigation. 
But see if the suggested edit helps. 

-----
Pinaki 
-- 
View this message in context: http://openjpa.208410.n2.nabble.com/bidirectional-one-to-many-relationship-with-join-table-tp678479p5152078.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Mime
View raw message