// license-header java merge-point // // Attention: Generated code! Do not modify by hand! // Generated by EntityEmbeddable.vsl in andromda-ejb3-cartridge on 09/18/2014 16:56:06. // package org.andromda.test.howto9.b; import java.io.Serializable; import javax.persistence.Column; import javax.persistence.DiscriminatorColumn; import javax.persistence.DiscriminatorType; import javax.persistence.DiscriminatorValue; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Inheritance; import javax.persistence.InheritanceType; import javax.persistence.NamedQuery; import javax.persistence.Table; import javax.validation.constraints.NotNull; /** *
* TODO: Model Documentation for org.andromda.test.howto9.b.Vehicle *
* * Autogenerated POJO EJB class for Vehicle containing the * bulk of the entity implementation. * * This is autogenerated by AndroMDA using the EJB3 * cartridge. * * DO NOT MODIFY this class. */ @Entity @Table(name="VEHICLE") @Inheritance(strategy=InheritanceType.SINGLE_TABLE) @DiscriminatorColumn(name="TYPE", discriminatorType=DiscriminatorType.STRING) @DiscriminatorValue("V") @NamedQuery(name="Vehicle.findAll", query="SELECT v FROM Vehicle AS v") public class Vehicle implements Serializable, Comparable* TODO: Model Documentation for make *
* Get the make property. * @return String The value of make */ @Column(name="MAKE", nullable=false, insertable=true, updatable=true) @NotNull(message="make is required") public String getMake() { return this.make; } /** ** TODO: Model Documentation for make *
* Set the make property. * @param value the new value */ public void setMake(String value) { this.make = value; } /** ** TODO: Model Documentation for model *
* Get the model property. * @return String The value of model */ @Column(name="MODEL", nullable=false, insertable=true, updatable=true) @NotNull(message="model is required") public String getModel() { return this.model; } /** ** TODO: Model Documentation for model *
* Set the model property. * @param value the new value */ public void setModel(String value) { this.model = value; } /** ** TODO: Model Documentation for age *
* Get the age property. * @return short The value of age */ @Column(name="AGE", nullable=false, insertable=true, updatable=true) @NotNull(message="age is required") public short getAge() { return this.age; } /** ** TODO: Model Documentation for age *
* Set the age property. * @param value the new value */ public void setAge(short value) { this.age = value; } /** ** TODO: Model Documentation for id *
* Get the id property. * @return Long The value of id */ @Id @GeneratedValue(strategy=GenerationType.AUTO) @Column(name="ID", nullable=false, insertable=true, updatable=true) public Long getId() { return this.id; } /** ** TODO: Model Documentation for id *
* Set the id property. * @param value the new value */ public void setId(Long value) { this.id = value; } // ------------- 0 Relations ------------------ // --------------- Constructors ----------------- /** * Default empty no-arg constructor */ public Vehicle() { // Default empty constructor } /** * Constructor with all updatable Entity attributes except auto incremented identifiers. * * @param make String value for the make property required=true lower=1 * @param model String value for the model property required=true lower=1 * @param age short value for the age property required=true lower=1 */ public Vehicle(String make, String model, short age) { this.make = make; this.model = model; this.age = age; } // -------- Common Methods ----------- /** * Indicates if the argument is of the same type and all values are equal. * @param object The target object to compare with * @return boolean True if both objects a 'equal' * @see Object#equals(Object) */ @Override public boolean equals(Object object) { if (null == object) { return false; } if (this == object) { return true; } if (!(object instanceof Vehicle)) { return false; } final Vehicle that = (Vehicle)object; if (this.getId() == null || that.getId() == null || !this.getId().equals(that.getId())) { return false; } return true; } /** * Returns a hash code value for the object * @return int The hash code value * @see Object#hashCode */ @Override public int hashCode() { int hashCode = 0; hashCode = 29 * hashCode + (getId() == null ? 0 : getId().hashCode()); return hashCode; } /** * Returns a String representation of the object * @return String Textual representation of the object displaying name/value pairs for all attributes * @see Object#toString */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("Vehicle("); sb.append(" make=").append(getMake()); sb.append(" model=").append(getModel()); sb.append(" age=").append(getAge()); sb.append(" id=").append(getId()); sb.append(")"); return sb.toString(); } /** * @see Comparable#compareTo */ @Override public int compareTo(Vehicle o) { int cmp = 0; if (this.getId() != null) { cmp = this.getId().compareTo(o.getId()); } else { if (this.getMake() != null) { cmp = (cmp != 0 ? cmp : this.getMake().compareTo(o.getMake())); } if (this.getModel() != null) { cmp = (cmp != 0 ? cmp : this.getModel().compareTo(o.getModel())); } } return cmp; } }