[英]Error While Creating Entities in Spring boot application
我一直在尝试在我的 spring 应用程序中创建一个继承其他类内容的实体。 我希望继承类的字段保留在数据库中,但一切都是徒劳的。 我也在使用龙目岛。 我在这里做错了吗?
儿童班:
@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserDetails extends Users{
@Id
Long uId;
String description;
String postalAddress;
Long postalCode;
}
父类:
public class Users {
Long userId;
String username;
String email;
String password;
}
类用户也将是一个实体,但它没有用相同的“@Entity”注释。 此外,您可能必须为父类提供 @Inheritance 注释。
参考 - https://blog.netgloo.com/2014/12/18/handling-entities-inheritance-with-spring-data-jpa/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.