[ 
https://issues.apache.org/jira/browse/OPENJPA-1570?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Oliver Ringel updated OPENJPA-1570:
-----------------------------------

    Description: 
An exception occurs if you add the @Strategy annotation on a field of an 
@Embeddable or @MappedSuperclass (not part of an @ElementCollection).
The  patch OPENJPA-1556.patch does not fix the problem.

<openjpa-2.0.0-beta2-rexportiert fatal user error> 
org.apache.openjpa.persistence.ArgumentException: Attempt to map 
"jpa.test.domain.TestEntityBase.testEnumSimple" failed: the owning entity is 
not mapped.

To be more concrete. I try to change the default enum handling using an own 
EnumValueHandler. The Handler is working if you add
the @Strategy to the @Entity. Adding @Strategy on a field in a 
@MappedSuperclass leads to the above exception.

@javax.persistence.Entity
@javax.persistence.Table(name = "TESTENTITY")
public class TestEntity extends TestEntityBase {
...
}

@MappedSuperclass
public abstract class TestEntityBase {
    @Column(name = "TESTENUMSIMPLE")
    @Enumerated(javax.persistence.EnumType.STRING)
    @Strategy("jpa.test.domain.EnumStrategy")
    private TestEnumSimple testEnumSimple;
...
}

You get the same Exception if you add the @Strategy to a @Embeddable and I also 
tried a own simple StringValueHandler with the same result.


  was:
the same exception occurs if you add the @Strategy annotation on a field of an 
@Embeddable or @MappedSuperclass (not part of an @ElementCollection).
The attached patch does not fix the problem.

<openjpa-2.0.0-beta2-rexportiert fatal user error> 
org.apache.openjpa.persistence.ArgumentException: Attempt to map 
"jpa.test.domain.TestEntityBase.testEnumSimple" failed: the owning entity is 
not mapped.

To be more concrete. I try to change the default enum handling using an own 
EnumValueHandler. The Handler is working if you add
the @Strategy to the @Entity. Adding @Strategy on a field in a 
@MappedSuperclass leads to the above exception.

@javax.persistence.Entity
@javax.persistence.Table(name = "TESTENTITY")
public class TestEntity extends TestEntityBase {
...
}

@MappedSuperclass
public abstract class TestEntityBase {
    @Column(name = "TESTENUMSIMPLE")
    @Enumerated(javax.persistence.EnumType.STRING)
    @Strategy("jpa.test.domain.EnumStrategy")
    private TestEnumSimple testEnumSimple;
...
}

You get the same Exception if you add the @Strategy to a @Embeddable and I also 
tried a own simple StringValueHandler with the same result.


        Summary: Exception using @Strategy in @MappedSuperclass or @Embeddable 
classes  (was: Exception using @Strategy in @MappedSuperclass @Embeddable 
classes)

> Exception using @Strategy in @MappedSuperclass or @Embeddable classes
> ---------------------------------------------------------------------
>
>                 Key: OPENJPA-1570
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1570
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 2.0.0-beta2
>         Environment: Ubuntu 9.10, Maven 2.2.1, Spring 3.0.1
>            Reporter: Oliver Ringel
>
> An exception occurs if you add the @Strategy annotation on a field of an 
> @Embeddable or @MappedSuperclass (not part of an @ElementCollection).
> The  patch OPENJPA-1556.patch does not fix the problem.
> <openjpa-2.0.0-beta2-rexportiert fatal user error> 
> org.apache.openjpa.persistence.ArgumentException: Attempt to map 
> "jpa.test.domain.TestEntityBase.testEnumSimple" failed: the owning entity is 
> not mapped.
> To be more concrete. I try to change the default enum handling using an own 
> EnumValueHandler. The Handler is working if you add
> the @Strategy to the @Entity. Adding @Strategy on a field in a 
> @MappedSuperclass leads to the above exception.
> @javax.persistence.Entity
> @javax.persistence.Table(name = "TESTENTITY")
> public class TestEntity extends TestEntityBase {
> ...
> }
> @MappedSuperclass
> public abstract class TestEntityBase {
>     @Column(name = "TESTENUMSIMPLE")
>     @Enumerated(javax.persistence.EnumType.STRING)
>     @Strategy("jpa.test.domain.EnumStrategy")
>     private TestEnumSimple testEnumSimple;
> ...
> }
> You get the same Exception if you add the @Strategy to a @Embeddable and I 
> also tried a own simple StringValueHandler with the same result.

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

Reply via email to