Extending an entity
Posted
by Kim L
on Stack Overflow
See other posts from Stack Overflow
or by Kim L
Published on 2010-03-21T19:45:26Z
Indexed on
2010/03/21
19:51 UTC
Read the original article
Hit count: 309
I have class named AbstractUser, which is annotated with @MappedSuperclass. Then I have a class named User (@Entity) which extends AbstractUser. Both of these exist in a package named foo.bar.framework. When I use these two classes, everything works just fine. But now I've imported a jar containing these files to another project. I'd like to reuse the User class and expand it with a few additional fields. I thought that @Entity public class User extends foo.bar.framework.User
would do the trick, but I found out that this implementation of the User only inherits the fields from AbstractUser, but nothing from foo.bar.framework.User. The question is, how can I get my second User class to inherit all the fields from the first User entity class?
Both User class implementation have different table names defined with @Table(name = "name").
© Stack Overflow or respective owner