- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
@Entity
@Table(name = "datastore")
public final class Datastore
{
@SequenceGenerator(name="SEQ_GEN", sequenceName="entity_id_seq", allocationSize = 1)
@Id
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator = "SEQ_GEN")
private long entityid;
public float capacity;
public String name;
public float usage;
public short vendor;
public short state;
public short health;
public short vmson;
public short vmsother;
@Transient private String uuid;
@Override public String toString() {
return String.format("Datastore{entityid=%d, capacity=%f, health=%d, name='%s', state=%d, usage=%f, vendor=%d, vmson=%d, vmsother=%d}",
entityid,
capacity,
health,
name,
state,
usage,
vendor,
vmson,
vmsother);
}
public long getEntityid() {
return entityid;
}
public void setEntityid(long entityid) {
this.entityid = entityid;
}
public float getCapacity() {
return capacity;
}
public void setCapacity(float capacity) {
this.capacity = capacity;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public float getUsage() {
return usage;
}
public void setUsage(float usage) {
this.usage = usage;
}
public short getVendor() {
return vendor;
}
public void setVendor(short vendor) {
this.vendor = vendor;
}
public short getState() {
return state;
}
public void setState(short state) {
this.state = state;
}
public short getHealth() {
return health;
}
public void setHealth(short health) {
this.health = health;
}
public short getVmson() {
return vmson;
}
public void setVmson(short vmson) {
this.vmson = vmson;
}
public short getVmsoff() {
return vmsother;
}
public void setVmsoff(short vmsoff) {
this.vmsother = vmsoff;
}
@Transient public void setUuid(String value) { this.uuid = value; }
}
Вот так жесткие швейцарские кодеры объявляют persistent beans.
Самый отжиг это не pubilc fields дублированные с getters/setters, а setter помеченный @Transient
insighter 21.10.2010 15:45 # 0
Lure Of Chaos 21.10.2010 16:26 # +1