net.yadaframework.commerce.persistence.entity.YadaCartItem Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of yadawebcommerce Show documentation
Show all versions of yadawebcommerce Show documentation
Yada Framework for E-Commerce sites
The newest version!
package net.yadaframework.commerce.persistence.entity;
import java.io.Serializable;
import java.util.Date;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Inheritance;
import jakarta.persistence.InheritanceType;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Temporal;
import jakarta.persistence.TemporalType;
import jakarta.persistence.Version;
@Entity
@Inheritance(strategy = InheritanceType.JOINED)
public class YadaCartItem implements Serializable {
private static final long serialVersionUID = 1L;
// For synchronization with external databases
@Column(insertable = false, updatable = false, columnDefinition="DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
@Temporal(TemporalType.TIMESTAMP)
protected Date modified;
// For optimistic locking
@Version
protected long version;
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
protected Long id;
protected int quantity;
@ManyToOne
protected YadaCommerceArticle article;
@ManyToOne
protected YadaCart cart;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public int getQuantity() {
return quantity;
}
public void setQuantity(int quantity) {
this.quantity = quantity;
}
public YadaCommerceArticle getArticle() {
return article;
}
public void setArticle(YadaCommerceArticle article) {
this.article = article;
}
public YadaCart getCart() {
return cart;
}
public void setCart(YadaCart cart) {
this.cart = cart;
}
public Date getModified() {
return modified;
}
public void setModified(Date modified) {
this.modified = modified;
}
public long getVersion() {
return version;
}
}