-
Notifications
You must be signed in to change notification settings - Fork 233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JPQL queries without WHERE clause or parameters fail #136
Comments
"DELETE FROM Country c " should work for you. |
It' s minor bug and it should have worked without giving alias as well! Here is a test case to demonstrate the same: Method: onInsertCassandra Sample:
-Vivek |
Fixed. All below variations are valid: For valid JPA grammar, see: In summary: select_statement ::= select_clause from_clause [where_clause] [groupby_clause] [having_clause] [orderby_clause] from_clause ::= FROM identification_variable_declaration {, {identification_variable_declaration | collection_member_declaration}}* Here identification variable is optional for UPDATE and DELETE queries, while mandatory for SELECT queries. Closing... |
it seems that any JPQL query without any parameters gets rejected by Kundera Cassandra.
e.g.
DELETE FROM Country
gives us
javax.persistence.PersistenceException: Bad query format: Country
at com.impetus.kundera.query.KunderaQuery.initEntityClass(KunderaQuery.java:349) ~[kundera-cassandra-2.1-jar-with-dependencies.jar:na]
at com.impetus.kundera.query.KunderaQuery.postParsingInit(KunderaQuery.java:334) ~[kundera-cassandra-2.1-jar-with-dependencies.jar:na]
at com.impetus.kundera.query.QueryResolver.getQueryImplementation(QueryResolver.java:75) ~[kundera-cassandra-2.1-jar-with-dependencies.jar:na]
at com.impetus.kundera.persistence.PersistenceDelegator.createQuery(PersistenceDelegator.java:558) ~[kundera-cassandra-2.1-jar-with-dependencies.jar:na]
at com.impetus.kundera.persistence.EntityManagerImpl.createQuery(EntityManagerImpl.java:441) ~[kundera-cassandra-2.1-jar-with-dependencies.jar:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_09]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_09]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_09]
at java.lang.reflect.Method.invoke(Method.java:601) ~[na:1.7.0_09]
at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:365) ~[spring-orm-3.1.2.RELEASE.jar:3.1.2.RELEASE]
at $Proxy29.createQuery(Unknown Source) ~[na:na]
Likewise for "SELECT FROM Country"
If I look at the code in KunderaQuery (lines 334-349) it does some weird splitting on ":" or "? " and if it doesn't find it rejects the query as invalid.
The Country entity in this case is trivial (with some Lombok @DaTa annotations)
@entity
@table(name="countries", schema="SCHEDULING@scheduling_pu")
@DaTa @EqualsAndHashCode(of="countryCode") @tostring(of={"countryCode","name"})
public class Country {
@id @column(name="country_code")
private String countryCode;
@column(name="name")
private String name;
}
The text was updated successfully, but these errors were encountered: