You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to run the following simple JPQL Update query, but DataNucleus is unable to parse the query string:
entityManager
.createQuery("UPDATE Setting s SET s.value = :valueToSet WHERE s.id = :id")
.setParameter("valueToSet", "my.new.value")
.setParameter("id", setting.getId())
.executeUpdate();
Here is the stacktrace:
12:15:06,230 (main) ERROR [DataNucleus.General] - >> Exception in test testUpdateSetting_doesNotWorkWithDN
Method/Identifier expected at character 1 in ""
org.datanucleus.store.query.QueryCompilerSyntaxException: Method/Identifier expected at character 1 in ""
at org.datanucleus.query.compiler.JPQLParser.processPrimary(JPQLParser.java:1390)
at org.datanucleus.query.compiler.JPQLParser.processUnaryExpression(JPQLParser.java:1221)
at org.datanucleus.query.compiler.JPQLParser.processMultiplicativeExpression(JPQLParser.java:1154)
at org.datanucleus.query.compiler.JPQLParser.processAdditiveExpression(JPQLParser.java:1125)
at org.datanucleus.query.compiler.JPQLParser.processRelationalExpression(JPQLParser.java:582)
at org.datanucleus.query.compiler.JPQLParser.processAndExpression(JPQLParser.java:565)
at org.datanucleus.query.compiler.JPQLParser.processOrExpression(JPQLParser.java:546)
at org.datanucleus.query.compiler.JPQLParser.processExpression(JPQLParser.java:535)
at org.datanucleus.query.compiler.JPQLParser.processFromExpression(JPQLParser.java:293)
at org.datanucleus.query.compiler.JPQLParser.parseFrom(JPQLParser.java:91)
at org.datanucleus.query.compiler.JavaQueryCompiler.compileFrom(JavaQueryCompiler.java:206)
at org.datanucleus.query.compiler.JPQLCompiler.compile(JPQLCompiler.java:84)
at org.datanucleus.store.query.AbstractJPQLQuery.compileGeneric(AbstractJPQLQuery.java:304)
at org.datanucleus.store.query.AbstractJPQLQuery.compileInternal(AbstractJPQLQuery.java:365)
at org.datanucleus.store.rdbms.query.JPQLQuery.compileInternal(JPQLQuery.java:235)
at org.datanucleus.store.query.Query.setImplicitParameter(Query.java:975)
at org.datanucleus.store.rdbms.query.JPQLQuery.setImplicitParameter(JPQLQuery.java:169)
at org.datanucleus.api.jpa.JPAQuery.setParameter(JPAQuery.java:548)
at org.datanucleus.api.jpa.JPAQuery.setParameter(JPAQuery.java:61)
at org.datanucleus.test.SimpleTest.lambda$testUpdateSetting_doesNotWorkWithDN$4(SimpleTest.java:112)
Using a different domain class works however:
entityManager
.createQuery("UPDATE Person p SET p.email = :email WHERE p.id = :id")
.setParameter("email", "luke@skywalk.er")
.setParameter("id", person.getId())
.executeUpdate()
This test case contains a set of Maven profiles that run the same tests against other JPA providers. The tests work as expected with EclipseLink and Hibernate, but not with DataNucleus.
To run the tests against DataNucleus (default profile): mvn clean compile test
To run the tests against EclipseLink: mvn clean compile test -P eclipselink
To run the tests against Hibernate: mvn clean compile test -P hibernate
The text was updated successfully, but these errors were encountered:
Hi!
I'm trying to run the following simple JPQL Update query, but DataNucleus is unable to parse the query string:
Here is the stacktrace:
Using a different domain class works however:
I suspect the issue might be at this line: https://github.com/datanucleus/datanucleus-core/blob/master/src/main/java/org/datanucleus/query/JPQLSingleStringParser.java#L310
Versions:
Am I missing something?
Test case: https://github.com/rm3l/dn-issue-updating-entity-with-set-in-name
This test case contains a set of Maven profiles that run the same tests against other JPA providers. The tests work as expected with EclipseLink and Hibernate, but not with DataNucleus.
To run the tests against DataNucleus (default profile):
mvn clean compile test
To run the tests against EclipseLink:
mvn clean compile test -P eclipselink
To run the tests against Hibernate:
mvn clean compile test -P hibernate
The text was updated successfully, but these errors were encountered: