mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#919 - io.ebean package initial
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
package org.tests.inheritance.model;
|
||||
|
||||
import javax.persistence.MappedSuperclass;
|
||||
|
||||
@MappedSuperclass
|
||||
public class AbstractBaseClass {
|
||||
private String name;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package org.tests.inheritance.model;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.ManyToOne;
|
||||
|
||||
@Entity
|
||||
public class CalculationResult {
|
||||
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
private Integer id;
|
||||
|
||||
private double charge;
|
||||
|
||||
@ManyToOne(cascade = CascadeType.PERSIST)
|
||||
private ProductConfiguration productConfiguration;
|
||||
|
||||
@ManyToOne(cascade = CascadeType.PERSIST)
|
||||
private GroupConfiguration groupConfiguration;
|
||||
|
||||
public double getCharge() {
|
||||
return charge;
|
||||
}
|
||||
|
||||
public void setCharge(double charge) {
|
||||
this.charge = charge;
|
||||
}
|
||||
|
||||
public ProductConfiguration getProductConfiguration() {
|
||||
return productConfiguration;
|
||||
}
|
||||
|
||||
public void setProductConfiguration(ProductConfiguration productConfiguration) {
|
||||
this.productConfiguration = productConfiguration;
|
||||
}
|
||||
|
||||
public GroupConfiguration getGroupConfiguration() {
|
||||
return groupConfiguration;
|
||||
}
|
||||
|
||||
public void setGroupConfiguration(GroupConfiguration groupConfiguration) {
|
||||
this.groupConfiguration = groupConfiguration;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package org.tests.inheritance.model;
|
||||
|
||||
import io.ebean.annotation.ChangeLog;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.DiscriminatorColumn;
|
||||
import javax.persistence.DiscriminatorType;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Inheritance;
|
||||
import javax.persistence.InheritanceType;
|
||||
import javax.persistence.ManyToOne;
|
||||
|
||||
@ChangeLog
|
||||
@Entity
|
||||
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
|
||||
@DiscriminatorColumn(name = "type", discriminatorType = DiscriminatorType.STRING)
|
||||
public class Configuration extends AbstractBaseClass {
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
private Integer id;
|
||||
|
||||
|
||||
@ManyToOne
|
||||
private Configurations configurations;
|
||||
|
||||
|
||||
public Configuration() {
|
||||
super();
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Configurations getConfigurations() {
|
||||
return configurations;
|
||||
}
|
||||
|
||||
public void setConfigurations(Configurations configurations) {
|
||||
this.configurations = configurations;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package org.tests.inheritance.model;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.OneToMany;
|
||||
import java.util.List;
|
||||
|
||||
@Entity
|
||||
public class Configurations {
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
private Integer id;
|
||||
|
||||
private String name;
|
||||
|
||||
@OneToMany
|
||||
private List<GroupConfiguration> groupConfigurations;
|
||||
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public List<GroupConfiguration> getGroupConfigurations() {
|
||||
return groupConfigurations;
|
||||
}
|
||||
|
||||
|
||||
public void setGroupConfigurations(List<GroupConfiguration> groupConfigurations) {
|
||||
this.groupConfigurations = groupConfigurations;
|
||||
}
|
||||
|
||||
public void add(GroupConfiguration groupConfiguration) {
|
||||
groupConfiguration.setConfigurations(this);
|
||||
groupConfigurations.add(groupConfiguration);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package org.tests.inheritance.model;
|
||||
|
||||
import javax.persistence.DiscriminatorValue;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.OneToMany;
|
||||
import java.util.List;
|
||||
|
||||
@Entity
|
||||
@DiscriminatorValue("2")
|
||||
public class GroupConfiguration extends Configuration {
|
||||
private String groupName;
|
||||
|
||||
@OneToMany(mappedBy = "groupConfiguration")
|
||||
private List<CalculationResult> results;
|
||||
|
||||
public GroupConfiguration() {
|
||||
super();
|
||||
}
|
||||
|
||||
public GroupConfiguration(String name) {
|
||||
super();
|
||||
this.groupName = name;
|
||||
}
|
||||
|
||||
public String getGroupName() {
|
||||
return groupName;
|
||||
}
|
||||
|
||||
public void setGroupName(String groupName) {
|
||||
this.groupName = groupName;
|
||||
}
|
||||
|
||||
public List<CalculationResult> getResults() {
|
||||
return results;
|
||||
}
|
||||
|
||||
public void setResults(List<CalculationResult> results) {
|
||||
this.results = results;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package org.tests.inheritance.model;
|
||||
|
||||
import javax.persistence.DiscriminatorValue;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.OneToMany;
|
||||
import java.util.List;
|
||||
|
||||
@Entity
|
||||
@DiscriminatorValue("1")
|
||||
public class ProductConfiguration extends Configuration {
|
||||
private String productName;
|
||||
|
||||
@OneToMany(mappedBy = "productConfiguration")
|
||||
private List<CalculationResult> results;
|
||||
|
||||
public ProductConfiguration() {
|
||||
super();
|
||||
}
|
||||
|
||||
public String getProductName() {
|
||||
return productName;
|
||||
}
|
||||
|
||||
public void setProductName(String productName) {
|
||||
this.productName = productName;
|
||||
}
|
||||
|
||||
public List<CalculationResult> getResults() {
|
||||
return results;
|
||||
}
|
||||
|
||||
public void setResults(List<CalculationResult> results) {
|
||||
this.results = results;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user