所有来自IgniteRepository的查询都可以正常工作,但是没有一个像下面这样的自定义查询不起作用。
@RepositoryConfig(cacheName = "orders")
public interface OrderRepository extends IgniteRepository<Order, Long> {
List<Order> findAllByClientId(Long clientId);
}
javax.cache.CacheException: Failed to parse query. Syntax error in SQL statement "SELECT ""orders"".""ORDER""._KEY, ""orders"".""ORDER""._VAL FROM ORDER[*] WHERE ((ORDER.CLIENTID=?)) "; expected "identifier"; SQL statement:
SELECT "orders"."ORDER"._KEY, "orders"."ORDER"._VAL FROM Order WHERE ((Order.clientId=?)) [42001-197]
缓存配置:
@TestConfiguration
@EnableIgniteRepositories("repositories")
public class RepositoriesTestConfig {
@Bean("igniteCfg")
public IgniteConfiguration igniteConfiguration() {
IgniteConfiguration igniteConfiguration = new IgniteConfiguration();
igniteConfiguration.setClientMode(false);
igniteConfiguration.setIgniteInstanceName(instanceName);
igniteConfiguration.setPeerClassLoadingEnabled(true);
CacheConfiguration<Long, Order> ordersCacheConfiguration = new CacheConfiguration<>("orders");
ordersCacheConfiguration.setIndexedTypes(Long.class, Order.class);
igniteConfiguration.setCacheConfiguration(ordersCacheConfiguration);
return igniteConfiguration;
}
@Bean("igniteInstance")
public Ignite igniteInstance(@Autowired IgniteConfiguration
igniteConfiguration) {
final Ignite ignite = Ignition.start(igniteConfiguration);
return ignite;
}
}
看来问题并不新鲜。但找不到任何解决方案。使用@Query注释时也会遇到同样的问题。
更新:
问题出在Order.class命名,Order1 –可以进行sql解析。