Hi Chris,
Your mapped superclass specification is erroneous,
however EclipeLink doesn't throw an exception and ignores it since your Address
class is declared as an @Entity.
So your model will still work without the
@MappedSuperclass. A class can not be both an @Entity and a
@MappedSuperclass.
Laird's question was outside of an entity
inheritance hierarchy using only a mapped superclass as the parent. @Table,
@Inheritance and @DiscriminatorColumn would not be processed in this
case.
Cheers,
Guy
----- Original Message -----
Sent: Monday, March 22, 2010 1:08
PM
Subject: Re: [eclipselink-users]
Specification/RI question
Sorry to chime in but I'm using
EclipseLink 1.1.2 in this way and it works as expected. (Or perhaps I didn't
understand the question correctly)
@Entity @Table(name =
"ADDRESS") @MappedSuperclass
@Inheritance(strategy =
InheritanceType.SINGLE_TABLE) @DiscriminatorColumn(name = "discriminator", discriminatorType
= DiscriminatorType.STRING, length = 10) public class Address implements Serializable, Cloneable { ...
}
@Entity @DiscriminatorValue(
value = "BillTo" ) public class BillTo
extends Address {...}
Chris
Mathrusse christopher.mathrusse@xxxxxxxxxx Sybase,
Inc
From:
| Guy Pelletier
<guy.pelletier@xxxxxxxxxx>
|
To:
| "EclipseLink User Discussions"
<eclipselink-users@xxxxxxxxxxx>
|
Date:
| 03/22/2010 06:06 AM
|
Subject:
| Re: [eclipselink-users]
Specification/RI question
|
Sent by:
| <eclipselink-users-bounces@xxxxxxxxxxx> |
Hi Laird, We currently do not support
this configuration. If you do place a @Table annotation on a mapped superclass
it is silently ignored. Considering it is not allowed in the schema definition I would
assume the spec does not intend them to be used with mapped superclasses
through annotations either. However, feel free to enter an enhancement request if you
feel this functionality is important.
Cheers, Guy ----- Original Message -----
From: Laird
Nelson To:
EclipseLink User Discussions
Sent: Friday, March 19, 2010 4:53 PM
Subject: [eclipselink-users] Specification/RI
question
Two questions, actually.
1. Is it
legal to place a @Table annotation on a @MappedSuperclass? I see nothing
in the specification that would prohibit this, but wanted to check with the
people who are making the reference implementation.
2. May two
@Entities share the same table, provided of course they populate it
correctly?
As in:
@MappedSuperclass @Table(name="shape") public class
AbstractFoo<V> { @Basic private String
fieldOne; // and so on }
@Entity public class ConcreteFoo1 extends
AbstractFoo<Bar> { // mostly @Transient and behavior
overrides }
@Entity public class ConcreteFoo2 extends
AbstractFoo<Baz> { // mostly @Transient and behavior
overrides }
It seems like the specification
permits this, but I wanted to check.
Thanks, Laird
_______________________________________________ eclipselink-users
mailing list eclipselink-users@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/eclipselink-users_______________________________________________ eclipselink-users
mailing list eclipselink-users@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/eclipselink-users
|