Hi,

Specify the new column names using @AttributeOverride /
@AttributeOverrides annotations (or their corresponding XML):

> @Entity
> @Table(name="events_course")
> public class Course extends AbstractObject {
> // the inherited attribute 'id' from AbstractObject is named 'course_id' in
> // the table 'events_course'. How can I do that using annotations?
> }

@Entity
@Table(name="events_course")
@AttributeOverride(name="id", column="course_id")
public class Course extends AbstractObject {
    ...
}

> @MappingSuperclass
> public abstract class AbstractObject {

FTR, it's @MappedSuperclass, not @MappingSuperclass.

-Patrick

On 9/4/07, Christian Eugster <[EMAIL PROTECTED]> wrote:
> Hi Patrick,
>
> My Subclasses have only the 'id' and the 'version' field of the superclass in 
> common, each has it own table and the tables primary key columns differ from 
> each other. So the subclasses inherit all the id attribute from the 
> superclass, but their corresponding column names differ.
>
> @MappingSuperclass
> public abstract class AbstractObject {
>   @Id
>   @GeneratedValue(strategy=GenerationType.IDENTITY)
>   private Long id;
> }
>
> @Entity
> @Table(name="events_course")
> public class Course extends AbstractObject {
> // the inherited attribute 'id' from AbstractObject is named 'course_id' in
> // the table 'events_course'. How can I do that using annotations?
> }
>
> @Entity
> @Table(name="events_customer")
> public class Customer extends AbstractObject {
> // the inherited attribute 'id' from AbstractObject is named 'customer_id'
> // in the table 'events_customer'. How can I do that using annotations?
> }
>
> @Entity
> @Table(name="events_booking")
> public class Booking extends AbstractObject {
> // the inherited attribute 'id' from AbstractObject is named 'booking_id'
> // in the table 'events_booking'. How can I do that using annotations?
> }
>
> Thank you in advance!
>
> Christian
>
>
> --
> ****************************
> Christian Eugster
> Grissian Widum 14
> I-39010 Tisens
> --------------------------------------
> Handy Schweiz: 0041 79 594 85 45
> Handy Italia: 0039 333 888 77 64
> Email: [EMAIL PROTECTED]
>
> GMX FreeMail: 1 GB Postfach, 5 E-Mail-Adressen, 10 Free SMS.
> Alle Infos und kostenlose Anmeldung: http://www.gmx.net/de/go/freemail
>


-- 
Patrick Linskey
202 669 5907

Reply via email to