openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Maria Jurcovicova (Created) (JIRA)" <j...@apache.org>
Subject [jira] [Created] (OPENJPA-2125) Default join table name does not follow JPA v2 specification
Date Fri, 10 Feb 2012 12:52:59 GMT
Default join table name does not follow JPA v2 specification
------------------------------------------------------------

                 Key: OPENJPA-2125
                 URL: https://issues.apache.org/jira/browse/OPENJPA-2125
             Project: OpenJPA
          Issue Type: Bug
          Components: jdbc, jpa
    Affects Versions: 2.1.1
            Reporter: Maria Jurcovicova


According to JPA v2 specification, two types of relationship use join table to keep relational
data: 
* many-to-many described in page 48,
* unidirectional one-to-many described in page 50.

In both cases, the joining table name should be composed from entity names (e.g. class names)
by default. OpenJPA uses entity table names by default.

Quote from JPA v2 specification:
"Entity A is mapped to a table named A. 
Entity B is mapped to a table named B. 

There is a join table that is named A_B (owner name first). The join table has ..."


Example entities:
@Entity
@Table(name="tblMtmOwner")
public class MtmOwner {
  @Id
  private long id;
  private String name;
  @ManyToMany
  private Collection<MtmInverse> inverses = new ArrayList<MtmInverse>();
}
 
@Entity
public class MtmInverse{
  @Id
  private long id;
  @ManyToMany(mappedBy="inverses")
  @MapKey(name="name")
  private Map<String, MtmOwner> owners = new HashMap<String, MtmOwner>();
}

Expected join table name: MtmOwner_MtmInverse
OpenJPA join table name:  tblMtmOwner_MtmInverse


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message