-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Wrong table name set when using schema export tool
PostPosted: Mon Jan 19, 2009 6:28 pm 
Newbie

Joined: Tue Sep 18, 2007 10:35 am
Posts: 8
I have a class Story that inherits from a base class called DomainObject that has common properties factored into it. When I explicitly set the table name to "Story" in the Story class using annotations, the schema export tool still creates a table named "domainobject". I'm using hibernate 3. Database is mysql5. Here is the relevant code. Anybody know what's up?



Code:
@Entity
public abstract class DomainObject<T> implements Serializable{
    private T id;
    private Date dateCreated = new Date();
    private Date dateUpdated;

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    public T getId() {
        return id;
    }

@Entity
@Table(name="Story")
public class Story extends DomainObject<Long> {
    private String headline;
    private String subject;
    private String body;
    private String image;
    private boolean publish;
    private int displayOrder;

    private int number;

    @Column
    public String getHeadline() {
        return headline;
    }


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 19, 2009 8:03 pm 
Newbie

Joined: Fri Feb 08, 2008 2:41 pm
Posts: 18
You should map an abstract class with the @MappedSuperclass annotation.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.