// license-header java merge-point // // This file can be safely modified. If deleted it will be regenerated. // Generated by Entity.vsl in andromda-ejb3-cartridge on 09/18/2014 16:56:07. // package org.andromda.test.howto7.a; import java.io.Serializable; import javax.persistence.Entity; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.Table; import javax.persistence.Transient; /** * Autogenerated POJO EJB3 implementation class for Car. * * Add any manual implementation within this class. This class will NOT * be overwritten with incremental changes. * *

* TODO: Model Documentation for org.andromda.test.howto7.a.Car *

* */ @Entity @Table(name = "CAR") // Uncomment to enable entity listener for Car // @javax.persistence.EntityListeners({org.andromda.test.howto7.a.CarListener.class}) // Uncomment to enable caching for Car // @org.hibernate.annotations.Cache(usage = org.hibernate.annotations.CacheConcurrencyStrategy.TRANSACTIONAL) @NamedQueries ({ @NamedQuery(name = "Car.findAll", query = "SELECT c FROM Car AS c"), @NamedQuery(name = "Car.findByType", query = "SELECT c from Car as c WHERE c.type = :type") }) public class Car extends CarEmbeddable implements Serializable, Comparable { /** * The serial version UID of this class required for serialization. */ private static final long serialVersionUID = -7140762284700160581L; // --------------- constructors ----------------- /** * Default Car constructor */ public Car() { super(); } /** * Implementation for the constructor with all POJO attributes except auto incremented identifiers. * This method sets all POJO fields defined in this/super class to the * values provided by the parameters. * */ public Car(String serial, String name, CarType type) { super(serial, name, type); } /** * Constructor with all POJO attribute values and CMR relations. * * @param serial Value for the serial property * @param name Value for the name property * @param type Value for the type property * @param owner Value for the owner relation */ public Car(String serial, String name, CarType type, Person owner) { super(serial, name, type, owner); } // -------------- Entity Methods ----------------- /** *

* Returns true if this car is current rented. *

*/ @Transient public boolean isRented() { // TODO put your implementation here. return false; } /** *

* Returns true if all cars are currently rented. *

*/ @Transient public static boolean allCarsAreRented() { // TODO put your implementation here. return false; } // --------------- Lifecycle callbacks ----------------- /** * @see Comparable#compareTo */ @Override public int compareTo(Car o) { int cmp = 0; if (this.getId() != null) { cmp = this.getId().compareTo(o.getId()); } else { if (this.getSerial() != null) { cmp = (cmp != 0 ? cmp : this.getSerial().compareTo(o.getSerial())); } if (this.getName() != null) { cmp = (cmp != 0 ? cmp : this.getName().compareTo(o.getName())); } if (this.getType() != null) { cmp = (cmp != 0 ? cmp : this.getType().compareTo(o.getType())); } } return cmp; } }