mirror of
https://github.com/apache/openjpa.git
synced 2025-03-06 08:29:08 +00:00
OPENJPA-1726: fix test case errors for Postgres
git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@964966 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
64181e58ad
commit
6820830299
@ -35,6 +35,9 @@ import javax.persistence.criteria.Join;
|
||||
import javax.persistence.criteria.CriteriaBuilder;
|
||||
import javax.persistence.criteria.Root;
|
||||
|
||||
import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
|
||||
import org.apache.openjpa.jdbc.sql.DBDictionary;
|
||||
import org.apache.openjpa.jdbc.sql.PostgresDictionary;
|
||||
import org.apache.openjpa.persistence.test.SingleEMFTestCase;
|
||||
|
||||
public class TestTypedResults extends SingleEMFTestCase {
|
||||
@ -121,7 +124,12 @@ public class TestTypedResults extends SingleEMFTestCase {
|
||||
List<Order> typedCriteriaResults = typedCriteriaQuery.getResultList();
|
||||
assertEquals(N_ORDERS / 2, typedCriteriaResults.size());
|
||||
|
||||
Query nativeQ = em.createNativeQuery("SELECT * FROM CRIT_RES_ORD o WHERE (o.filled = 1)", Order.class);
|
||||
|
||||
DBDictionary dict = ((JDBCConfiguration)emf.getConfiguration()).getDBDictionaryInstance();
|
||||
String sql = "SELECT * FROM CRIT_RES_ORD o WHERE (o.filled = 1)";
|
||||
if (dict instanceof PostgresDictionary)
|
||||
sql = "SELECT * FROM CRIT_RES_ORD o WHERE (o.filled = true)";
|
||||
Query nativeQ = em.createNativeQuery(sql, Order.class);
|
||||
// Don't suppress warnings.
|
||||
List<Order> typedNativeResults = nativeQ.getResultList();
|
||||
assertEquals(N_ORDERS / 2, typedNativeResults.size());
|
||||
|
@ -31,6 +31,7 @@ import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
|
||||
@ -38,6 +39,7 @@ import javax.persistence.TemporalType;
|
||||
* Used in testing; should be enhanced.
|
||||
*/
|
||||
@Entity
|
||||
@Table(name="DATART1")
|
||||
@DiscriminatorValue("dataRt1")
|
||||
public class RuntimeTest1
|
||||
implements Serializable {
|
||||
|
@ -204,7 +204,12 @@ public class TestJPQLScalarExpressions extends AbstractTestCase {
|
||||
rs = em.createQuery(query).getResultList();
|
||||
|
||||
result = (Object[]) rs.get(rs.size()-1);
|
||||
assertEquals(result[1], 1);
|
||||
|
||||
if (result[1] instanceof String)
|
||||
assertEquals(result[1], "true");
|
||||
else
|
||||
assertEquals(result[1], 1);
|
||||
|
||||
|
||||
startTx(em);
|
||||
String update = "update CompUser c set c.creditRating = " +
|
||||
|
@ -30,6 +30,7 @@ import junit.framework.Assert;
|
||||
import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
|
||||
import org.apache.openjpa.jdbc.sql.DBDictionary;
|
||||
import org.apache.openjpa.jdbc.sql.HSQLDictionary;
|
||||
import org.apache.openjpa.jdbc.sql.PostgresDictionary;
|
||||
import org.apache.openjpa.jdbc.sql.SQLServerDictionary;
|
||||
import org.apache.openjpa.persistence.test.SingleEMFTestCase;
|
||||
|
||||
@ -75,13 +76,13 @@ public class TestJDBCEscapeDate extends SingleEMFTestCase {
|
||||
// "select a from Employee a where a.hireTimestamp >= {ts '2009-08-25 00:00:00.123456'}",
|
||||
"select {t '00:00:00'}, a.empId from Employee a",
|
||||
};
|
||||
} else {
|
||||
} else if (dict instanceof PostgresDictionary) {
|
||||
jpql = new String[] {
|
||||
"select a from Employee a where a.hireDate >= {d '2009-08-25'}",
|
||||
"select a from Employee a where a.hireDate >= {d '2009-8-5'}",
|
||||
"select a from Employee a where a.hireTime >= {t '00:00:00'}",
|
||||
"select a from Employee a where a.hireTimestamp >= {ts '2009-08-25 00:00:00'}",
|
||||
"select a from Employee a where a.hireTimestamp >= {ts '2009-08-25 00:00:00.'}",
|
||||
//"select a from Employee a where a.hireTimestamp >= {ts '2009-08-25 00:00:00.'}",
|
||||
"select a from Employee a where a.hireTimestamp >= {ts '2009-08-25 00:00:00.1'}",
|
||||
"select a from Employee a where a.hireTimestamp >= {ts '2009-08-25 00:00:00.12'}",
|
||||
"select a from Employee a where a.hireTimestamp >= {ts '2009-08-25 00:00:00.123'}",
|
||||
@ -90,6 +91,21 @@ public class TestJDBCEscapeDate extends SingleEMFTestCase {
|
||||
"select a from Employee a where a.hireTimestamp >= {ts '2009-08-25 00:00:00.123456'}",
|
||||
"select {t '00:00:00'}, a.empId from Employee a",
|
||||
};
|
||||
} else {
|
||||
jpql = new String[] {
|
||||
"select a from Employee a where a.hireDate >= {d '2009-08-25'}",
|
||||
"select a from Employee a where a.hireDate >= {d '2009-8-5'}",
|
||||
"select a from Employee a where a.hireTime >= {t '00:00:00'}",
|
||||
"select a from Employee a where a.hireTimestamp >= {ts '2009-08-25 00:00:00'}",
|
||||
"select a from Employee a where a.hireTimestamp >= {ts '2009-08-25 00:00:00.'}",
|
||||
"select a from Employee a where a.hireTimestamp >= {ts '2009-08-25 00:00:00.1'}",
|
||||
"select a from Employee a where a.hireTimestamp >= {ts '2009-08-25 00:00:00.12'}",
|
||||
"select a from Employee a where a.hireTimestamp >= {ts '2009-08-25 00:00:00.123'}",
|
||||
"select a from Employee a where a.hireTimestamp >= {ts '2009-08-25 00:00:00.1234'}",
|
||||
"select a from Employee a where a.hireTimestamp >= {ts '2009-08-25 00:00:00.12345'}",
|
||||
"select a from Employee a where a.hireTimestamp >= {ts '2009-08-25 00:00:00.123456'}",
|
||||
"select {t '00:00:00'}, a.empId from Employee a",
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user