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

Wolfgang Winter commented on OPENJPA-1607:
------------------------------------------

Hi,

I also observe the exception on Tomee 1.6:
<openjpa-2.3.0-nonfinal-1540826-r422266:1542644 fatal user error> 
org.apache.openjpa.persistence.ArgumentException: 
You have supplied columns for 
"com.logitags.cibet.actuator.archive.Archive.resource.com.logitags.cibet.core.Resource.parameters",
 but this mapping cannot have columns in this context.
        at 
org.apache.openjpa.jdbc.meta.MappingInfo.assertNoSchemaComponents(MappingInfo.java:382)

with the mappings listed below. It is working without problems on 
Glassfish/Eclipselink without join table. 
Is there any solution for this issue?

@Entity
public class Archive implements Serializable {

   @Id
   @GeneratedValue(strategy = GenerationType.TABLE, generator = "CIB_SEQUENCE")
   @TableGenerator(name = "CIB_SEQUENCE", table = "CIB_SEQUENCE", pkColumnName 
= "SEQUENCE", valueColumnName = "HI", pkColumnValue = "Archive", allocationSize 
= 1)
   private long archiveId;

   @Embedded
   @AssociationOverride(name = "parameters", joinColumns = @JoinColumn(name = 
"archiveId", referencedColumnName = "archiveId"))
   private Resource resource;
   
}

@Entity
public class DcControllable implements Serializable {

   @Id
   @GeneratedValue(strategy = GenerationType.AUTO)
   private long dcControllableId;

   @Embedded
   @AssociationOverride(name = "parameters", joinColumns = @JoinColumn(name = 
"dcControllableId", referencedColumnName = "dcControllableId"))
   private Resource resource;

}


@Embeddable
public class Resource implements Serializable, Cloneable {

   @OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY)
   @JoinColumn(name = "dummy")
   private List<ResourceParameter> parameters = new 
LinkedList<ResourceParameter>();

}


> 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 was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to