users@glassfish.java.net

Bug in TopLink

From: Markus KARG <markus.karg_at_gmx.net>
Date: Mon, 31 Dec 2007 17:41:30 +0100

I think I found a bug in TopLink and want to discuss with you before
hastily reporting it officially.

There is one entity that has a compound key made up of two fields, and
it has a sub-entity using @Inheritance(strategy = JOINED). I can insert
new rows using the super class directly, but when I want to use the
sub-class, TopLink produces a SQL INSERT statement that just fills one
of the compound key's fields -- and forgets the other one! Certainly the
database server complains about that.

In fact, I'd like to know whether that is a real bug or whether I am
doing something wrong (in that case, please tell me what I am doing
wrong and where in the JPA specification that is told).

Here is the interesting part of the source code:

@Entity
@Inheritance(strategy = JOINED)
public abstract class TheSuperClass {

    @Id
    @ManyToOne
    private Invoice invoice; // TheSuperClass actually is part of an Invoice

    @Id
    private int position; // Inside of the Invoice, we identify multiple
instances using this int

...

@Entity
public final class TheSubClass extends TheSuperClass { // TheSubClass is
a specialization of TheSuperClass

(there is no additional code in this class, since it I stripped away
everything for this small sample)


I am totally stuck with that problem. Please help me. :-)

Thanks
Markus

-- 
http://www.xing.com/go/invita/58469