OPENJPA-1793 - New test case testEntityA_Embed_Single_Coll caused "ORA-01861: literal does not match format string" when run against Oracle due to default DATE column format differences. (See http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/sql_elements004.htm)

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@1029821 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Albert Lee 2010-11-01 20:19:32 +00:00
parent c4d891525d
commit ab326efe07
2 changed files with 6 additions and 7 deletions

View File

@ -49,6 +49,6 @@ public class Department2 {
}
public void addEmployee(Employee2 emp) {
empMap.put(emp.getEmpPK(), emp);
getEmpMap().put(emp.getEmpPK(), emp);
}
}

View File

@ -60,8 +60,7 @@ public class TestEmbeddable extends SQLListenerTestCase {
public int numEmployeesPerPhoneNumber = 1;
public int numPhoneNumbersPerEmployee = 2;
public int numEmployeesPerProgramManager = 2;
public int numEmployees = numProgramManagers
* numEmployeesPerProgramManager;
public int numEmployees = numProgramManagers * numEmployeesPerProgramManager;
public int numPhoneNumbers = numEmployees * numPhoneNumbersPerEmployee;
public int numDepartments = 2;
public int numEmployeesPerDept = 2;
@ -79,8 +78,7 @@ public class TestEmbeddable extends SQLListenerTestCase {
public int phoneId = 1;
public int pmId = 1;
public int parkingSpotId = 1;
public Map<Integer, PhoneNumber> phones =
new HashMap<Integer, PhoneNumber>();
public Map<Integer, PhoneNumber> phones = new HashMap<Integer, PhoneNumber>();
public Map<Integer, Employee> employees = new HashMap<Integer, Employee>();
public void setUp() {
@ -108,7 +106,7 @@ public class TestEmbeddable extends SQLListenerTestCase {
EntityA_Embed_Complex.class, A.class, CLEAR_TABLES);
sql.clear();
DBDictionary dict = ((JDBCConfiguration)emf.getConfiguration()).getDBDictionaryInstance();
if (dict.getClass().getName().indexOf("oracle") != -1) {
if (dict.getClass().getName().toLowerCase().indexOf("oracle") != -1) {
((OracleDictionary)dict).useTriggersForAutoAssign = true;
}
}
@ -188,7 +186,8 @@ public class TestEmbeddable extends SQLListenerTestCase {
//string (even the simplest string will do).
em = emf.createEntityManager();
Query query1 = em.createQuery("SELECT e FROM EntityA_Embed_Single_Coll e "
+ "where e.embed.date = '" + date + "'");
+ "where e.embed.date = :wheredate");
query1.setParameter("wheredate", date);
eesc = (EntityA_Embed_Single_Coll) query1.getSingleResult();
assertEquals(eesc.getEmbed().getDate().toString(), date.toString());
em.close();