openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kevin Sutter (JIRA)" <j...@apache.org>
Subject [jira] Commented: (OPENJPA-1607) Using unidirectional one-to-many target foreign key throws exception
Date Thu, 16 Dec 2010 20:55:00 GMT

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

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

Okay, I just reproduced it...

<openjpa-2.1.0-SNAPSHOT-r422266:1045352 fatal user error> org.apache.openjpa.persistence.ArgumentException:
You have supplied columns for "org.apache.openjpa.persistence.compat.EntityC_B1MJT.bi1mjt<element:class
java.lang.Object>", but this mapping cannot have columns in this context.

But, I had to change my persistence.xml to reference the 1.0 xsd instead of the 2.0 xsd:

<persistence
    xmlns="http://java.sun.com/xml/ns/persistence"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
        http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
    version="1.0" >

If I use the 2.0 xsd, then everything works as expected.

When I look at the original testcase posted, there were two persistence.xml files in the package.
One had 1.0, the other had 2.0. So, depending on which one was referenced, it could cause
the error.

Can you check which xsd is being utilized in your respective environments?

The reason for the difference is that the OneToMany with FK was not supported in JPA 1.0.
Thus, the check for the condition and the error message. But, with JPA 2.0, this is FK is
supported.

My take is that is working as designed, as long as the originators of the JIRA can verify
the proper xsd is being used.

Thanks,
Kevin


> 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.


Mime
View raw message