1 package ejava.examples.orm.inheritance.annotated;
2
3 import javax.persistence.*;
4
5
6
7
8
9
10
11
12 @Entity
13 @Table(name="ORMINH_ALBUM")
14 @AttributeOverrides({
15 @AttributeOverride(name="version", column=@Column(name="ALBUM_VERSION"))
16 })
17 public class Album extends BaseObject {
18 @Access(AccessType.FIELD)
19 private String artist;
20 @Access(AccessType.FIELD)
21 private String title;
22
23 @Id @GeneratedValue
24 @Column(name="ALBUM_ID")
25 public long getId() { return super.getId(); }
26 protected void setId(long id) {
27 super.setId(id);
28 }
29
30 public String getArtist() { return artist; }
31 public void setArtist(String artist) {
32 this.artist = artist;
33 }
34
35 public String getTitle() { return title; }
36 public void setTitle(String title) {
37 this.title = title;
38 }
39
40 @Transient
41 public String getName() { return artist + ":" + title; }
42
43 public String toString() {
44 StringBuilder text = new StringBuilder(super.toString());
45 return text.toString();
46 }
47 }