openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Romain Manni-Bucau (JIRA)" <j...@apache.org>
Subject [jira] [Created] (OPENJPA-2254) @OneToOne @Id doesn't work if the id specify @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
Date Mon, 20 Aug 2012 12:48:37 GMT
Romain Manni-Bucau created OPENJPA-2254:
-------------------------------------------

             Summary: @OneToOne @Id doesn't work if the id specify @Inheritance(strategy =
InheritanceType.TABLE_PER_CLASS)
                 Key: OPENJPA-2254
                 URL: https://issues.apache.org/jira/browse/OPENJPA-2254
             Project: OpenJPA
          Issue Type: Bug
            Reporter: Romain Manni-Bucau
             Fix For: 2.2.0


here how to reproduce:

@Entity
public class A {
    @Id
    @OneToOne(cascade = ALL, orphanRemoval = true)
    private B b;

...
}

@Entity
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) // doesn't work with this line
public abstract class B {
    @Id
    private String	id;

...
}

then C is just a B child

test:
        em.getTransaction().begin();

        final C c = new C();
        c.setId("foo");
        em.persist(c);

        final A a= new A();
        a.setB(c);
        em.persist(a);

        em.getTransaction().commit();

       assertNotNull(em.find(A.class, c.getId()));


Note: without @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) it works fine

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message