OPENJPA-2373: Made a test case update given identity auto generated ids do not work so well for some databases.

git-svn-id: https://svn.apache.org/repos/asf/openjpa/branches/2.0.x@1485011 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Heath Thomann 2013-05-21 23:27:45 +00:00
parent 62f3924e54
commit 2a3791bc03
2 changed files with 29 additions and 4 deletions

View File

@ -26,11 +26,11 @@ import javax.persistence.Embeddable;
public class PartPK implements Serializable {
/*Textile Id*/
@Column(name="ID_TXE", length=4)
@Column(name="ID_TXE")
private Integer textileId;
/*Part Number*/
@Column(name="NU_PT", length=4)
@Column(name="NU_PT")
private Integer partNumber;
public PartPK() {

View File

@ -19,10 +19,19 @@
package org.apache.openjpa.persistence.inheritance.jointable.onetomany;
import javax.naming.NamingException;
import java.io.IOException;
import java.sql.SQLException;
import javax.persistence.EntityManager;
import javax.persistence.EntityTransaction;
import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
import org.apache.openjpa.jdbc.meta.MappingTool;
import org.apache.openjpa.jdbc.meta.MappingTool.Flags;
import org.apache.openjpa.jdbc.sql.DBDictionary;
import org.apache.openjpa.jdbc.sql.OracleDictionary;
import org.apache.openjpa.jdbc.sql.SQLServerDictionary;
import org.apache.openjpa.jdbc.sql.SybaseDictionary;
import org.apache.openjpa.persistence.common.apps.Part;
import org.apache.openjpa.persistence.common.apps.PartPK;
import org.apache.openjpa.persistence.common.apps.Shirt;
@ -62,15 +71,31 @@ import org.apache.openjpa.persistence.test.SingleEMFTestCase;
*
*/
public class TestMapsIdWithAutoGeneratedKey extends SingleEMFTestCase {
boolean disabled = false;
public void setUp() {
super.setUp(DROP_TABLES,
Textile.class, TextilePK.class,
Shirt.class, Trousers.class,
Part.class, PartPK.class);
DBDictionary dic = ((JDBCConfiguration)emf.getConfiguration()).getDBDictionaryInstance();
if (!dic.supportsAutoAssign) {
disabled = true;
return;
}
if (dic instanceof SQLServerDictionary || dic instanceof OracleDictionary || dic instanceof SybaseDictionary) {
disabled = true;
return;
}
}
public void testPersistShirtWithPart() throws NamingException {
public void testPersistShirtWithPart() {
if (disabled) {
return;
}
EntityManager em = emf.createEntityManager();
EntityTransaction tx = em.getTransaction();
int nPart = 3;