You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Oliver Ringel (JIRA)" <ji...@apache.org> on 2010/04/01 12:58:27 UTC

[jira] Created: (OPENJPA-1607) Using unidirectional one-to-many target foreign key throws exception

Using unidirectional one-to-many target foreign key throws exception
--------------------------------------------------------------------

                 Key: OPENJPA-1607
                 URL: https://issues.apache.org/jira/browse/OPENJPA-1607
             Project: OpenJPA
          Issue Type: Bug
    Affects Versions: 2.0.0-beta3
            Reporter: Oliver Ringel


Using this simple unidirectional relationship

@OneToMany
@JoinColumn(name = "DEPARTMENT_ID")
private Set<Employee> employees;

causes to the following exception

<openjpa-2.0.0-beta3-r422266:926797 fatal user error> org.apache.openjpa.persistence.ArgumentException: You have supplied columns for "com.example.Department.employees", but this mapping cannot have columns in this context.

Unidirectional one-to-many target foreign key relationship should be supported in JPA 2.0.


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


[jira] Updated: (OPENJPA-1607) Using unidirectional one-to-many target foreign key throws exception

Posted by "Oliver Ringel (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-1607?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oliver Ringel updated OPENJPA-1607:
-----------------------------------

    Attachment: openjpa-1607.tar

Here is the test case.

> Using unidirectional one-to-many target foreign key throws exception
> --------------------------------------------------------------------
>
>                 Key: OPENJPA-1607
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1607
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 2.0.0-beta3
>            Reporter: Oliver Ringel
>         Attachments: openjpa-1607.tar
>
>
> Using this simple unidirectional relationship
> @OneToMany
> @JoinColumn(name = "DEPARTMENT_ID")
> private Set<Employee> employees;
> causes to the following exception
> <openjpa-2.0.0-beta3-r422266:926797 fatal user error> org.apache.openjpa.persistence.ArgumentException: You have supplied columns for "com.example.Department.employees", but this mapping cannot have columns in this context.
> Unidirectional one-to-many target foreign key relationship should be supported in JPA 2.0.

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


[jira] Commented: (OPENJPA-1607) Using unidirectional one-to-many target foreign key throws exception

Posted by "Oliver Ringel (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1607?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12852394#action_12852394 ] 

Oliver Ringel commented on OPENJPA-1607:
----------------------------------------

Hi Thomas,

sorry, but I have to disagree. Using a jointable ist default behaviour if you not use @JoinColumn, 
but the JPA 2.0 spec also supports unidirectional one-to-many relationships without the need of jointables.
See section 11.1.21 JoinColumn Annotation of the JPA 2.0 spec.

The RI supports this kind of relationships.


> Using unidirectional one-to-many target foreign key throws exception
> --------------------------------------------------------------------
>
>                 Key: OPENJPA-1607
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1607
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 2.0.0-beta3
>            Reporter: Oliver Ringel
>         Attachments: openjpa-1607.tar
>
>
> Using this simple unidirectional relationship
> @OneToMany
> @JoinColumn(name = "DEPARTMENT_ID")
> private Set<Employee> employees;
> causes to the following exception
> <openjpa-2.0.0-beta3-r422266:926797 fatal user error> org.apache.openjpa.persistence.ArgumentException: You have supplied columns for "com.example.Department.employees", but this mapping cannot have columns in this context.
> Unidirectional one-to-many target foreign key relationship should be supported in JPA 2.0.

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


[jira] Commented: (OPENJPA-1607) Using unidirectional one-to-many target foreign key throws exception

Posted by "Thomas O Rowe (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1607?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12852363#action_12852363 ] 

Thomas O Rowe commented on OPENJPA-1607:
----------------------------------------

I believe a join table is required, not a join column.  The JPA 2.0 spec has an example in section 2.10.5.1 that illuminates further.

> Using unidirectional one-to-many target foreign key throws exception
> --------------------------------------------------------------------
>
>                 Key: OPENJPA-1607
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1607
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 2.0.0-beta3
>            Reporter: Oliver Ringel
>         Attachments: openjpa-1607.tar
>
>
> Using this simple unidirectional relationship
> @OneToMany
> @JoinColumn(name = "DEPARTMENT_ID")
> private Set<Employee> employees;
> causes to the following exception
> <openjpa-2.0.0-beta3-r422266:926797 fatal user error> org.apache.openjpa.persistence.ArgumentException: You have supplied columns for "com.example.Department.employees", but this mapping cannot have columns in this context.
> Unidirectional one-to-many target foreign key relationship should be supported in JPA 2.0.

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