OrderInfo.java
// license-header java merge-point
//
// Attention: Generated code! Do not modify by hand!
// Generated by EntityEmbeddable.vsl in andromda-ejb3-cartridge on 08/08/2014 12:21:03.
//
package org.andromda.demo.ejb3.order;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
/**
* <p>
* TODO: Model Documentation for org.andromda.demo.ejb3.order.OrderInfo
* </p>
*
* Autogenerated POJO EJB class for OrderInfo containing the
* bulk of the entity implementation.
*
* This is autogenerated by AndroMDA using the EJB3
* cartridge.
*
* DO NOT MODIFY this class.
*/
@Entity
@Table(name="PRODUCTORDER")
@NamedQueries
({
@NamedQuery(name="OrderInfo.findAll", query="SELECT o FROM OrderInfo AS o"),
@NamedQuery(name="OrderInfo.findAllByIndex", query="SELECT o from OrderInfo as o"),
@NamedQuery(name="OrderInfo.findAllWithLimits", query="SELECT o from OrderInfo as o")
})
public class OrderInfo
implements Serializable, Comparable<OrderInfo>{
private static final long serialVersionUID = 7900373850889662406L;
// ----------- 3 Attribute Definitions ------------
protected Long id;
protected String description;
protected int volume;
// -------- 3 Attribute Accessors ----------
/**
* <p>
* TODO: Model Documentation for id
* </p>
* 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;
}
/**
* <p>
* TODO: Model Documentation for id
* </p>
* Set the id property.
* @param value the new value
*/
public void setId(Long value)
{
this.id = value;
}
/**
* <p>
* TODO: Model Documentation for description
* </p>
* Get the description property.
* @return String The value of description
*/
@Column(name="DESCRIPTION", insertable=true, updatable=true, length=50)
@Size(max=50)
public String getDescription()
{
return this.description;
}
/**
* <p>
* TODO: Model Documentation for description
* </p>
* Set the description property.
* @param value the new value
*/
public void setDescription(String value)
{
this.description = value;
}
/**
* <p>
* TODO: Model Documentation for volume
* </p>
* Get the volume property.
* @return int The value of volume
*/
@Column(name="VOLUME", nullable=false, insertable=true, updatable=true)
@NotNull(message="volume is required")
public int getVolume()
{
return this.volume;
}
/**
* <p>
* TODO: Model Documentation for volume
* </p>
* Set the volume property.
* @param value the new value
*/
public void setVolume(int value)
{
this.volume = value;
}
// ------------- 0 Relations ------------------
// --------------- Constructors -----------------
/**
* Default empty no-arg constructor
*/
public OrderInfo()
{
// Default empty constructor
}
/**
* Constructor with all updatable Entity attributes except auto incremented identifiers.
*
* @param description String value for the description property required=false lower=0
* @param volume int value for the volume property required=true lower=1
*/
public OrderInfo(String description, int volume)
{
this.description = description;
this.volume = volume;
}
/**
* Constructor with required Entity attributes except auto incremented identifiers.
*
* @param volume Value for the volume property
*/
public OrderInfo(int volume)
{
this.volume = volume;
}
// -------- 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 OrderInfo))
{
return false;
}
final OrderInfo that = (OrderInfo)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("OrderInfo(");
sb.append(" id=").append(getId());
sb.append(" description=").append(getDescription());
sb.append(" volume=").append(getVolume());
sb.append(")");
return sb.toString();
}
/**
* @see Comparable#compareTo
*/
@Override
public int compareTo(OrderInfo o)
{
int cmp = 0;
if (this.getId() != null)
{
cmp = this.getId().compareTo(o.getId());
}
else
{
if (this.getDescription() != null)
{
cmp = (cmp != 0 ? cmp : this.getDescription().compareTo(o.getDescription()));
}
}
return cmp;
}
}