1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
@Entity
@Table(catalog = "sdcarbrp", schema = "dbo", name = "t_car_location")
@EntityListeners( { TestEventListener.class })
public class Location implements Serializable,Comparable<Location>{
@Id
@Column(name = "id_location")
@GeneratedValue(strategy = GenerationType.AUTO)
private String id;
@Column(name = "nm_name")
private String name;
@Column(name = "fl_deleted")
private boolean deleted = false;
public Location(){
System.out.println("INIT");
}
@PostLoad
public void postLoad() {
System.out.println("OOOOKKKKK");
if (id == null || id.trim().length() == 0)
name = "";
char subChar = id.charAt(Constant.LG_CODE_LOCATION - 1);
boolean isDigit = Character.isDigit(subChar);
String newId = id.substring(0, Constant.LG_CODE_LOCATION);
String newName = isDigit ? newId + "XXX" : Constant.LOCATION_NBY_START + newId;
name = newName;
} |
Partager