mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Attempt to create test case for #281 - test case not failing
This commit is contained in:
@@ -729,6 +729,9 @@ public class DeployBeanDescriptor<T> {
|
||||
return null;
|
||||
}
|
||||
String selectClause = sb.toString();
|
||||
if (selectClause.length() == 0) {
|
||||
throw new IllegalStateException("Bean " + getFullName() + " has no properties?");
|
||||
}
|
||||
return selectClause.substring(0, selectClause.length() - 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.avaje.tests.inheritance;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
/**
|
||||
*/
|
||||
@Entity
|
||||
public class InnerReport {
|
||||
|
||||
@Id
|
||||
Long id;
|
||||
|
||||
String name;
|
||||
|
||||
@OneToOne
|
||||
Forecast forecast;
|
||||
|
||||
public Forecast getForecast() {
|
||||
return forecast;
|
||||
}
|
||||
|
||||
public void setForecast(Forecast forecast) {
|
||||
this.forecast = forecast;
|
||||
}
|
||||
|
||||
|
||||
@Entity
|
||||
@DiscriminatorValue("F")
|
||||
public static class Forecast extends Stockforecast {
|
||||
|
||||
@ManyToOne
|
||||
InnerReport innerReport;
|
||||
|
||||
public InnerReport getInnerReport() {
|
||||
return innerReport;
|
||||
}
|
||||
|
||||
public void setInnerReport(InnerReport innerReport) {
|
||||
this.innerReport = innerReport;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.avaje.tests.inheritance;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
|
||||
@Entity
|
||||
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
|
||||
@DiscriminatorColumn(name = "type", discriminatorType = DiscriminatorType.STRING)
|
||||
public abstract class Stockforecast {
|
||||
|
||||
@Id
|
||||
private Long id;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.avaje.tests.inheritance;
|
||||
|
||||
import com.avaje.ebean.BaseTestCase;
|
||||
import com.avaje.ebean.Ebean;
|
||||
import org.junit.Test;
|
||||
|
||||
public class TestNpeOnDiscriminator extends BaseTestCase {
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
|
||||
InnerReport report = Ebean.json().toBean(InnerReport.class, "{}");
|
||||
Ebean.save(report);
|
||||
|
||||
// other service ...
|
||||
InnerReport.Forecast f = new InnerReport.Forecast();
|
||||
report.setForecast(f);
|
||||
f.innerReport = report;
|
||||
|
||||
Ebean.save(f);
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user