openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Patrick Linskey" <plins...@gmail.com>
Subject Re: Identity Problem with MappedSuperclass
Date Thu, 05 Jul 2007 14:11:12 GMT
Hi,

We have test cases that demonstrate that distinct subtypes of a
@MappedSuperclass can share the same ID value [1], so the behavior
you're expecting should be possible in the general sense. Our test
case doesn't use GenerationType.IDENTITY, though.

Can you post the exception that you're seeing and the corresponding SQL log?

-Patrick

[1] https://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/inheritance/TestSharedMappedSuperclassIdValue.java?view=log

On 7/5/07, Daniel Migowski <dmigowski@ikoffice.de> wrote:
> Hello OpenJPA users.
>
> Ich have the following Class hierarchie and want to define the id (with
> @GeneratedValue(strategy=GenerationType.IDENTITY)) in the parent class:
>
>  Base    <- @MappedSuperclass - defines an @Id-Field
>  /  \
> A    B   <- @Entity
>
> Now OpenJPA uses the same identity range for all thos objects, even if
> the @Id-Field is not in an @Entity-Class but in a @MappedSuperclass, and
> as such does not have a database equivalent.
>
> Expected behaviour is (and this is because the id fields get all mapped
> in their own tables) that OpenJPA sees the fields of the mapped
> superclass as fields of the derived entites (in fact, the superclass in
> not an entity at all) without any corellation between them.
>
> Is this a bug or intentional behavour? Do i really have to define the
> field in the derived classes?
>
> Greetings,
> Daniel Migowski
>


-- 
Patrick Linskey
202 669 5907

Mime
View raw message