mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#960 - Incorrect query when using '.betweenProperties' with '@SoftDelete'
This commit is contained in:
@@ -12,6 +12,13 @@ public class BetweenPropertyExpressionTest {
|
||||
return new BetweenPropertyExpression(lowProperty, highProperty, value);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void sqlExpression() {
|
||||
TDSpiExpressionRequest request = new TDSpiExpressionRequest(null);
|
||||
exp("a", "b", 10).addSql(request);
|
||||
assertThat(request.getSql()).isEqualTo(" ? between a and b ");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isSameByPlan_when_same() {
|
||||
assertThat(exp("a", "b", 10).isSameByPlan(exp("a", "b", 10))).isTrue();
|
||||
|
||||
@@ -17,6 +17,8 @@ public class TDSpiExpressionRequest implements SpiExpressionRequest {
|
||||
|
||||
final BeanDescriptor<?> descriptor;
|
||||
|
||||
StringBuilder sql = new StringBuilder();
|
||||
|
||||
public TDSpiExpressionRequest(BeanDescriptor<?> descriptor) {
|
||||
this.descriptor = descriptor;
|
||||
}
|
||||
@@ -42,8 +44,9 @@ public class TDSpiExpressionRequest implements SpiExpressionRequest {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SpiExpressionRequest append(String sql) {
|
||||
return null;
|
||||
public SpiExpressionRequest append(String sqlExpression) {
|
||||
sql.append(sqlExpression);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -58,7 +61,7 @@ public class TDSpiExpressionRequest implements SpiExpressionRequest {
|
||||
|
||||
@Override
|
||||
public String getSql() {
|
||||
return null;
|
||||
return sql.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -239,7 +239,7 @@ public class EqlParserTest extends BaseTestCase {
|
||||
Query<Customer> query = parse("where 'x' between name and smallnote");
|
||||
query.findList();
|
||||
|
||||
assertThat(query.getGeneratedSql()).contains("where ? between t0.name and t0.smallnote");
|
||||
assertThat(query.getGeneratedSql()).contains("where ? between t0.name and t0.smallnote");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -249,7 +249,7 @@ public class EqlParserTest extends BaseTestCase {
|
||||
query.setParameter("some", "A");
|
||||
query.findList();
|
||||
|
||||
assertThat(query.getGeneratedSql()).contains("where ? between t0.name and t0.smallnote");
|
||||
assertThat(query.getGeneratedSql()).contains("where ? between t0.name and t0.smallnote");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user