[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
RE: [eclipselink-users] BaseEntity
|
Hi,
I'm doing the same and it works for me. You should not forget to declare
@Table at the derived classes and the BaseEntity should be also listed in
the persistence.xml.
--
Kind regards,
Mathias
> -----Original Message-----
> From: eclipselink-users-bounces@xxxxxxxxxxx
> [mailto:eclipselink-users-bounces@xxxxxxxxxxx] On Behalf Of Leon Derks
> Sent: Thursday, April 17, 2008 5:43 PM
> To: EclipseLink User Discussions
> Subject: [eclipselink-users] BaseEntity
>
>
> Hello
>
> Is it possible to have one single BaseEntity class that contains a
> general used id for all other entity classes?
>
> Like this:
> @MappedSuperclass
> public abstract class BaseEntity {
>
> @Id
> @GeneratedValue(generator="seqGen")
> @SequenceGenerator(name="seqGen",sequenceName="PLI_SEQ",
> allocationSize=1)
> private long id;
>
> public long getId() {
> return id;
> }
>
> And that all my entity classes are extending from this BaseEntity.
> Because then I don't need all kind of similar id variables in
> my entity
> classes.
>
> I tried this, but it results in an error. Because it wants to select
> from the table BaseEntity and this doesn't exists of course.
>
> Am I doing something wrong with my jpa mapping?
>
> greetz,
> Leon
> _______________________________________________
> eclipselink-users mailing list
> eclipselink-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/eclipselink-users