@MappedSuperclass的用法
用在实体的继承过程中的父类上;
父类Cat
1 package com.xj.model; 2 3 import javax.persistence.GeneratedValue; 4 import javax.persistence.Id; 5 import javax.persistence.MappedSuperclass; 6 7 @MappedSuperclass 8 public class Cat { 9 private Long id; 10 private String name; 11 @Id 12 @GeneratedValue 13 public Long getId() { 14 return id; 15 } 16 public void setId(Long id) { 17 this.id = id; 18 } 19 public String getName() { 20 return name; 21 } 22 public void setName(String name) { 23 this.name = name; 24 } 25 }