mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-10-23 07:51:04 +00:00
#1657 - ERROR BeanDescriptorManager - Error in deployment java.lang.RuntimeException: Expecting [ ... ] to start with "select"
This commit is contained in:
@@ -433,7 +433,13 @@ public class BeanDescriptorManager implements BeanDescriptorMap {
|
||||
|
||||
} else {
|
||||
for (XmRawSql sql : entityDeploy.getRawSql()) {
|
||||
RawSqlBuilder builder = RawSqlBuilder.parse(sql.getQuery().getValue());
|
||||
RawSqlBuilder builder;
|
||||
try {
|
||||
builder = RawSqlBuilder.parse(sql.getQuery().getValue());
|
||||
} catch (RuntimeException e) {
|
||||
builder = RawSqlBuilder.unparsed(sql.getQuery().getValue());
|
||||
}
|
||||
|
||||
for (XmColumnMapping columnMapping : sql.getColumnMapping()) {
|
||||
builder.columnMapping(columnMapping.getColumn(), columnMapping.getProperty());
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ import io.ebean.RawSql;
|
||||
import io.ebean.RawSqlBuilder;
|
||||
import io.ebean.annotation.IgnorePlatform;
|
||||
import io.ebean.annotation.Platform;
|
||||
|
||||
import org.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
@@ -77,6 +76,19 @@ public class TestRawSqlOrmQuery extends BaseTestCase {
|
||||
assertThat(sql).contains("where o.status = ? order by c.name, c.id");
|
||||
}
|
||||
|
||||
@IgnorePlatform(Platform.ORACLE)
|
||||
@Test
|
||||
public void testNamed_fromCustomXmlLocations_withComments() {
|
||||
|
||||
ResetBasicData.reset();
|
||||
|
||||
Query<Order> query = Ebean.createNamedQuery(Order.class, "myRawTest3");
|
||||
query.setMaxRows(10);
|
||||
|
||||
List<Order> list = query.findList();
|
||||
assertThat(list).isNotEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
|
||||
|
||||
@@ -14,6 +14,17 @@
|
||||
order by c.name, c.id
|
||||
</query>
|
||||
</raw-sql>
|
||||
|
||||
<raw-sql name="myRawTest3">
|
||||
<column-mapping column="o.id" property="id"/>
|
||||
<column-mapping column="o.status" property="status"/>
|
||||
<query>
|
||||
-- must be unparsed raw sql
|
||||
select o.id, o.status
|
||||
from o_order o
|
||||
</query>
|
||||
</raw-sql>
|
||||
|
||||
</entity>
|
||||
|
||||
</ebean>
|
||||
|
||||
Reference in New Issue
Block a user