mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
95 lines
1.5 KiB
Java
95 lines
1.5 KiB
Java
package com.avaje.tests.model.tevent;
|
|
|
|
import com.avaje.ebean.annotation.Aggregation;
|
|
|
|
import javax.persistence.CascadeType;
|
|
import javax.persistence.Entity;
|
|
import javax.persistence.Id;
|
|
import javax.persistence.OneToMany;
|
|
import javax.persistence.OneToOne;
|
|
import javax.persistence.Version;
|
|
import java.util.List;
|
|
|
|
@Entity
|
|
public class TEventOne {
|
|
|
|
@Id
|
|
Long id;
|
|
|
|
String name;
|
|
|
|
@Version
|
|
Long version;
|
|
|
|
@OneToOne
|
|
TEvent event;
|
|
|
|
@Aggregation("count(logs.*)")
|
|
Long count;
|
|
|
|
@Aggregation("sum(logs.units)")
|
|
Double totalUnits;
|
|
|
|
@Aggregation("sum(logs.units * logs.amount)")
|
|
Double totalAmount;
|
|
|
|
@OneToMany(mappedBy = "event", cascade = CascadeType.ALL)
|
|
List<TEventMany> logs;
|
|
|
|
public TEventOne(String name) {
|
|
this.name = name;
|
|
}
|
|
|
|
public Long getId() {
|
|
return id;
|
|
}
|
|
|
|
public void setId(Long id) {
|
|
this.id = id;
|
|
}
|
|
|
|
public Long getCount() {
|
|
return count;
|
|
}
|
|
|
|
public Double getTotalUnits() {
|
|
return totalUnits;
|
|
}
|
|
|
|
public Double getTotalAmount() {
|
|
return totalAmount;
|
|
}
|
|
|
|
public String getName() {
|
|
return name;
|
|
}
|
|
|
|
public void setName(String name) {
|
|
this.name = name;
|
|
}
|
|
|
|
public Long getVersion() {
|
|
return version;
|
|
}
|
|
|
|
public void setVersion(Long version) {
|
|
this.version = version;
|
|
}
|
|
|
|
public TEvent getEvent() {
|
|
return event;
|
|
}
|
|
|
|
public void setEvent(TEvent event) {
|
|
this.event = event;
|
|
}
|
|
|
|
public List<TEventMany> getLogs() {
|
|
return logs;
|
|
}
|
|
|
|
public void setLogs(List<TEventMany> logs) {
|
|
this.logs = logs;
|
|
}
|
|
}
|