Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsReference to Superclass
https://www.eclipse.org/forums/index.php/mv/msg/317699/830332/#msg_830332
I have an abstract superclass, which is the superclass of every entity:
@MappedSuperclass
public abstract class AbstractEntity
implements Serializable {
// ...
}
@Entity
@Table(name = "BLUBB")
public class Blubb extends AbstractEntity {
JPA returns an error, that I can not use AbstractEntity there. But I don't know, which type of entity is returned at this point. I have stored the type in another entity, here I need a reference to the specific instance. But actually the only thing I need is the ID of the instance.
How I can prevent that error?
Exception Description: [class Blubb] uses a non-entity [class AbstractEntity] as target entity in the relationship attribute [field instance]..
Thanks a lot
Andre]]>A.Rothe 2012-03-27T13:46:15-00:00Re: Reference to Superclass
https://www.eclipse.org/forums/index.php/mv/msg/317699/831209/#msg_831209
Can you explain the relationship a bit or what you are trying to accomplish? It isn't clear why you would want to have Blubb with a 1:1 that can hold any instance, or how you would expect to represent this in the database. When you read in a Blubb, it needs to use that mapping to read in a thing instance, so the type needs to be determined somehow.
If the type is determined somewhere else (I assume you mean other entities are extending Blubb), why not map the 'thing' at those points?