com.infusers.core.order.CustomerOrder Maven / Gradle / Ivy
package com.infusers.core.order;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.infusers.core.search.ISpecificationModel;
import jakarta.persistence.CascadeType;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.OneToMany;
import jakarta.persistence.PrePersist;
import jakarta.persistence.SequenceGenerator;
//@RedisHash(value="customerorders")
//@TypeAlias(value="customerorders")
@Entity
public class CustomerOrder implements ISpecificationModel{
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "INFUSERS")
@SequenceGenerator(name = "INFUSERS", sequenceName = "CO_SEQ", allocationSize = 1)
private Long id;
private Date createdAt;
private String userName;
@PrePersist
void createdAt() {
this.createdAt = new Date();
}
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@JoinColumn(name = "id")
private List orderItemList = new ArrayList<>();
public CustomerOrder() {
super();
this.createdAt();
}
public CustomerOrder(Long id, List orderItemList, String userName) {
super();
this.id = id;
this.orderItemList = orderItemList;
this.userName = userName;
this.createdAt();
}
public CustomerOrder(String userName) {
super();
this.userName = userName;
this.createdAt();
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public List getOrderItemList() {
return orderItemList;
}
public void setOrderItemList(List orderItemList) {
this.orderItemList = orderItemList;
}
public void addOrderItem(OrderItem orderItem) {
orderItemList.add(orderItem);
}
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy