跳转到内容

Java 持久化/Ebean/示例模型/订单详情

来自 Wikibooks,开放世界的开放书籍
package com.avaje.tests.model.basic;

import java.io.Serializable;
import java.sql.Timestamp;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Version;

/**
 * Order Detail entity bean.
 */
@Entity
@Table(name = "o_order_detail")
public class OrderDetail implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    Integer id;

    @ManyToOne(cascade = CascadeType.ALL)
    Order order;

    Integer orderQty;

    Integer shipQty;

    Double unitPrice;

    @ManyToOne
    Product product;

    Timestamp cretime;

    @Version
    Timestamp updtime;

    public OrderDetail() {
    }

    public OrderDetail(Product product, Integer orderQty, Double unitPrice) {
        this.product = product;
        this.orderQty = orderQty;
        this.unitPrice = unitPrice;
    }

    /**
     * Return id.
     */
    public Integer getId() {
        return id;
    }

    /**
     * Set id.
     */
    public void setId(Integer id) {
        this.id = id;
    }

    /**
     * Return order qty.
     */
    public Integer getOrderQty() {
        return orderQty;
    }

    /**
     * Set order qty.
     */
    public void setOrderQty(Integer orderQty) {
        this.orderQty = orderQty;
    }

    /**
     * Return ship qty.
     */
    public Integer getShipQty() {
        return shipQty;
    }

    /**
     * Set ship qty.
     */
    public void setShipQty(Integer shipQty) {
        this.shipQty = shipQty;
    }

    public Double getUnitPrice() {
        return unitPrice;
    }

    public void setUnitPrice(Double unitPrice) {
        this.unitPrice = unitPrice;
    }

    /**
     * Return cretime.
     */
    public Timestamp getCretime() {
        return cretime;
    }

    /**
     * Set cretime.
     */
    public void setCretime(Timestamp cretime) {
        this.cretime = cretime;
    }

    /**
     * Return updtime.
     */
    public Timestamp getUpdtime() {
        return updtime;
    }

    /**
     * Set updtime.
     */
    public void setUpdtime(Timestamp updtime) {
        this.updtime = updtime;
    }

    /**
     * Return order.
     */
    public Order getOrder() {
        return order;
    }

    /**
     * Set order.
     */
    public void setOrder(Order order) {
        this.order = order;
    }

    /**
     * Return product.
     */
    public Product getProduct() {
        return product;
    }

    /**
     * Set product.
     */
    public void setProduct(Product product) {
        this.product = product;
    }

}
华夏公益教科书