Skip to content

Commit

Permalink
#208 fixed NEGATE handling in OpenJPA
Browse files Browse the repository at this point in the history
  • Loading branch information
timowest committed Jul 31, 2012
1 parent f6c8f28 commit e5f0a08
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
Expand Up @@ -28,6 +28,7 @@ public class OpenJPATemplates extends JPQLTemplates{
public OpenJPATemplates() {
this(DEFAULT_ESCAPE);
add(Ops.ALIAS, "{0} {1}");
add(Ops.NEGATE, "-1 * {0}", 7);
}

public OpenJPATemplates(char escape) {
Expand Down
Expand Up @@ -763,6 +763,11 @@ public void Sum_3_Projected() {
assertEquals(val, projection.val, 0.001);
}

@Test
public void Sum_4() {
query().from(cat).uniqueResult(cat.bodyWeight.sum().negate());
}

@Test
public void Sum_as_Float() {
float val = query().from(cat).uniqueResult(cat.floatProperty.sum());
Expand Down
2 changes: 1 addition & 1 deletion querydsl-jpa/src/test/resources/META-INF/persistence.xml
Expand Up @@ -144,7 +144,7 @@
<property name="javax.persistence.jdbc.driver" value="org.h2.Driver" />
<property name="javax.persistence.jdbc.url" value="jdbc:h2:target/h2-3" />
<property name="javax.persistence.jdbc.user" value="sa" />
<property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(SchemaAction='dropDB',ForeignKeys=true)"/>
<property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
<property name="openjpa.RuntimeUnenhancedClasses" value="supported" />
<property name="openjpa.jdbc.Schemas" value="PUBLIC"/>
<property name="openjpa.jdbc.DBDictionary" value="h2(useSchemaName=true)"/>
Expand Down

0 comments on commit e5f0a08

Please sign in to comment.