blob: b6d16b61fd1f5601161699b2ea8e9d50e122c0d1 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2012 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* Contributors:
* Oracle - initial impl
******************************************************************************/
package model;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Embeddable;
import javax.persistence.OneToOne;
import org.eclipse.persistence.nosql.annotations.DataFormatType;
import org.eclipse.persistence.nosql.annotations.NoSql;
import relational.model.Product;
/**
* OrderLine, stored as part of the Order document.
* @author James Sutherland
*/
@Embeddable
@NoSql(dataFormat=DataFormatType.MAPPED)
public class OrderLine implements Serializable {
@Basic
private int lineNumber;
@OneToOne(cascade={CascadeType.REMOVE, CascadeType.PERSIST})
private Product product;
@Basic
private double cost = 0;
public OrderLine() {
}
public OrderLine(Product product, double cost) {
this.product = product;
this.cost = cost;
}
public int getLineNumber() {
return lineNumber;
}
public void setLineNumber(int lineNumber) {
this.lineNumber = lineNumber;
}
public Product getProduct() {
return product;
}
public void setProduct(Product product) {
this.product = product;
}
public double getCost() {
return cost;
}
public void setCost(double cost) {
this.cost = cost;
}
}