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

Kevin Sutter commented on OPENJPA-1607:
---------------------------------------

Unfortunately, this still seems to be an issue.  I just talked with a customer 
that is experiencing the same type of ArgumentException when using the 
@JoinColumn with a @OneToMany.  They are using a 2.0 persistence.xml and they 
have the related entities defined in <class> elements in their persistence.xml. 
 Since we do have testcases that supposedly test this condition, there must be 
some other aspect of the scenario that is alluding us.  I have not been able to 
reproduce the issue myself with a junit, but I have seen the output from this 
customer's system.

They have a simple mapping like this:

@Entity
@Table(name="xbo")
public class Company implements CodedEntity, Presentable {
                
        @OneToMany(fetch = FetchType.LAZY)
        @JoinColumn(name="bol", referencedColumnName="bol")
        private List<CompanyText> texts;

And, the resulting stacktrace is similar to what's been reported here and in 
openjpa-1253:

Exception in thread "main" <openjpa-2.2.1-r422266:1396819 fatal user error> 
org.apache.openjpa.persistence.ArgumentException: You have supplied columns for 
"mycom.domain.Company.companyTexts", but this mapping cannot have columns in 
this context. 
        at 
org.apache.openjpa.jdbc.meta.MappingInfo.assertNoSchemaComponents(MappingInfo.java:382)
 
        :

This seems to be a real issue that needs resolution.


                
> 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.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to