In short, the following model doesn’t work with bytecode enhancement; the data will be loaded correctly, but calling getName on a loaded entity will always return null for some reason:
@MappedSuperclass
public class AbstractEntity {
@Column(length = 40, unique = true)
private String name;
}
@Entity
@Table(name = "known_fruits")
public class Fruit extends AbstractEntity {
@Id
private Integer id;
@Column(length = 40, unique = true)
private String name;
public Fruit() {
}
public Fruit(String name) {
this.name = name;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}