Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for @Inheritance #41

Open
SingingBush opened this issue Sep 17, 2016 · 0 comments
Open

add support for @Inheritance #41

SingingBush opened this issue Sep 17, 2016 · 0 comments
Assignees

Comments

@SingingBush
Copy link
Collaborator

Hibernate allows support for inheritance making it possible to things like this:

@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name="content_type", discriminatorType=DiscriminatorType.STRING)
@Table("site_content")
public class SiteContent {
    @Id
    @Generated
    public uint id;

    @Column("title") @NotNull
    public string title;

    @Column("content") @NotNull
    public string content; // LONGTEXT
}

@Entity
@DiscriminatorValue("wikipage")
public class WikiPage : SiteContent {}

@Entity
@DiscriminatorValue("blogpost")
public class BlogPost : SiteContent {}

More information on @Inheritance and the related annotations can be found here.

@buggins buggins self-assigned this Sep 22, 2016
vnayar pushed a commit to vnayar/hibernated that referenced this issue Oct 17, 2023
Fixed referenced code (missing imports)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants