openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kevin Sutter (Commented) (JIRA)" <>
Subject [jira] [Commented] (OPENJPA-2125) Default join table name does not follow JPA v2 specification
Date Wed, 22 Feb 2012 14:49:48 GMT


Kevin Sutter commented on OPENJPA-2125:

I think you answered your own question.  If you look at the specification excerpt you quoted,
it says that "Entity A is mapped to *table* named A.  Entity B is mapped to a *table* named
B."  So, the join table name is the concatenation of those two table names (A_B).  If the
Entity has an @Table annotation, then that Entity would be mapped to the *table* identified
by that @Table annotation.  So, I believe this is working as designed.
> Default join table name does not follow JPA v2 specification
> ------------------------------------------------------------
>                 Key: OPENJPA-2125
>                 URL:
>             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
> * 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:!default.jspa
For more information on JIRA, see:


View raw message