#208 fixed NEGATE handling in OpenJPA

This commit is contained in:
Timo Westkämper 2012-07-31 20:50:11 +03:00
parent f6c8f280b8
commit e5f0a080f7
3 changed files with 7 additions and 1 deletions

View File

@ -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) {

View File

@ -763,6 +763,11 @@ public abstract class AbstractStandardTest {
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());

View File

@ -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)"/>