Author: allee8285
Date: Mon Mar 2 19:32:14 2009
New Revision: 749423
URL: http://svn.apache.org/viewvc?rev=749423&view=rev
Log:
OPENJPA-903 - Commit contribution submitted by Tim McConnell. [Ref:
http://archives.postgresql.org/pgsql-jdbc/2008-01/msg00089.php]
Modified:
openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/PostgresDictionary.java
openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/exception/TestException.java
Modified:
openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/PostgresDictionary.java
URL:
http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/PostgresDictionary.java?rev=749423&r1=749422&r2=749423&view=diff
==============================================================================
---
openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/PostgresDictionary.java
(original)
+++
openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/PostgresDictionary.java
Mon Mar 2 19:32:14 2009
@@ -144,6 +144,7 @@
}));
supportsLockingWithDistinctClause = false;
+ supportsQueryTimeout = false;
supportsLockingWithOuterJoin = false;
supportsNullTableForGetImportedKeys = true;
Modified:
openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/exception/TestException.java
URL:
http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/exception/TestException.java?rev=749423&r1=749422&r2=749423&view=diff
==============================================================================
---
openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/exception/TestException.java
(original)
+++
openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/exception/TestException.java
Mon Mar 2 19:32:14 2009
@@ -29,6 +29,7 @@
import javax.persistence.Query;
import javax.persistence.TransactionRequiredException;
+import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
import org.apache.openjpa.jdbc.sql.DBDictionary;
import org.apache.openjpa.jdbc.sql.SQLErrorCodeReader;
import org.apache.openjpa.persistence.test.SingleEMFTestCase;
@@ -54,6 +55,10 @@
* exception thrown is an instance of
javax.persistence.OptimisticException.
*/
public void testThrowsOptimisticException() {
+
+ boolean supportsQueryTimeout = ((JDBCConfiguration) emf
+
.getConfiguration()).getDBDictionaryInstance().supportsQueryTimeout;
+
EntityManager em1 = emf.createEntityManager();
EntityManager em2 = emf.createEntityManager();
assertNotEquals(em1, em2);
@@ -75,14 +80,18 @@
assertTrue(pc1 != pc2);
pc1.setName("Modified in TXN1");
- em1.flush();
- try {
- pc2.setName("Modified in TXN2");
- em2.flush();
- fail("Expected " + OptimisticLockException.class);
- } catch (Throwable t) {
- assertException(t, OptimisticLockException.class);
- }
+ if (supportsQueryTimeout) {
+ em1.flush();
+ try {
+ pc2.setName("Modified in TXN2");
+ em2.flush();
+ fail("Expected " + OptimisticLockException.class);
+ } catch (Throwable t) {
+ assertException(t, OptimisticLockException.class);
+ }
+ } else {
+ pc2.setName("Modified in TXN2");
+ }
em1.getTransaction().commit();
try {