Index: doc/release-notes.xml
===================================================================
RCS file: /scm/castor/castor/src/doc/release-notes.xml,v
retrieving revision 1.69
diff -u -r1.69 release-notes.xml
--- doc/release-notes.xml 5 Jul 2005 13:25:41 -0000 1.69
+++ doc/release-notes.xml 15 Jul 2005 21:46:46 -0000
@@ -30,6 +30,23 @@
+
+
+ Added support for polymorphism.
+
+
+ Werner Guttmann
+ werner.guttmann@gmx.net
+
+
+ Werner Guttmann
+ werner.guttmann@gmx.net
+
+ Werner Guttmann
+ Enh.
+ JDO
+ 20050715
+
Refactor CTF-JDO tests into subdirectories (part 2).
Index: etc/CHANGELOG
===================================================================
RCS file: /scm/castor/castor/src/etc/CHANGELOG,v
retrieving revision 1.232
diff -u -r1.232 CHANGELOG
--- etc/CHANGELOG 5 Jul 2005 13:25:41 -0000 1.232
+++ etc/CHANGELOG 15 Jul 2005 21:46:57 -0000
@@ -2,6 +2,11 @@
Version (CVS)
-------------
+JDO: Fixed bug CASTOR-1018 using contribution from Werner Guttmann[werner.guttmann@gmx.net]
+ Added support for polymorphism.
+ Details: http://jira.codehaus.org/browse/CASTOR-1018
+ (Werner - 20050715)
+
JDO: Fixed bug CASTOR-1110 using contribution from Ralf Joachim [ralf.joachim@syscon-world.de]
Refactor CTF-JDO tests into subdirectories (part 2).
Details: http://jira.codehaus.org/browse/CASTOR-1110
Index: main/org/castor/persist/TransactionContext.java
===================================================================
RCS file: /scm/castor/castor/src/main/org/castor/persist/TransactionContext.java,v
retrieving revision 1.1
diff -u -r1.1 TransactionContext.java
--- main/org/castor/persist/TransactionContext.java 20 Jun 2005 12:00:59 -0000 1.1
+++ main/org/castor/persist/TransactionContext.java 15 Jul 2005 21:47:03 -0000
@@ -548,10 +548,10 @@
public synchronized Object load(final LockEngine engine,
final ClassMolder molder,
final Object identity,
- Object objectToBeLoaded,
+ ProposedObject proposedObject,
final AccessMode suggestedAccessMode)
throws ObjectNotFoundException, LockNotGrantedException, PersistenceException {
- return load(engine, molder, identity, objectToBeLoaded,
+ return load(engine, molder, identity, proposedObject,
suggestedAccessMode, null);
}
@@ -571,7 +571,7 @@
* The class persistence molder
* @param identity
* The object's identity
- * @param objectToBeLoaded
+ * @param proposedObject
* The object to fetch (single instance per transaction)
* @param suggestedAccessMode
* The access mode (see {@link AccessMode}) the values in
@@ -590,7 +590,7 @@
public synchronized Object load(final LockEngine engine,
final ClassMolder molder,
final Object identity,
- Object objectToBeLoaded,
+ ProposedObject proposedObject,
final AccessMode suggestedAccessMode,
QueryResults results)
throws ObjectNotFoundException, LockNotGrantedException, PersistenceException {
@@ -605,12 +605,11 @@
// Test that the object to be loaded (which we will fill in) is of an
// appropriate type for our molder.
- if (objectToBeLoaded != null
+ if (proposedObject.getObject() != null
&& !molder.getJavaClass(_db.getClassLoader()).isAssignableFrom(
- objectToBeLoaded.getClass())) {
+ proposedObject.getProposedClass())) {
throw new PersistenceException(Messages.format(
- "persist.typeMismatch", molder.getName(), objectToBeLoaded
- .getClass()));
+ "persist.typeMismatch", molder.getName(), proposedObject.getProposedClass()));
}
oid = new OID(engine, molder, identity);
@@ -627,8 +626,10 @@
// If the object has been loaded, but the instance sugguested to
// be loaded into is not the same as the loaded instance,
// error is reported.
- if (objectToBeLoaded != null
- && objectToBeLoaded != objectInTransaction) {
+
+ // TODO [WG]: could read && propsedObject != objectInTransaction
+ if (proposedObject.getObject() != null
+ && proposedObject.getObject() != objectInTransaction) {
throw new PersistenceException(Messages.format(
"persist.multipleLoad", molder.getName(), identity));
}
@@ -687,13 +688,13 @@
return objectInTransaction;
}
- // Load (or reload) the object through the persistence engine with the
- // requested lock. This might report failure (object no longer exists),
- // hold until a suitable lock is granted (or fail to grant), or
+ // Load (or reload, in case the object is stored in a acache) the object through the
+ // persistence engine with the requested lock. This might report failure (object no
+ // longer exists), hold until a suitable lock is granted (or fail to grant), or
// report error with the persistence engine.
try {
- if (objectToBeLoaded != null) {
- objectInTransaction = objectToBeLoaded;
+ if (proposedObject.getObject() != null) {
+ objectInTransaction = proposedObject.getObject();
} else {
// ssa, multi classloader feature
// ssa, FIXME : No better way to do that ?
@@ -705,15 +706,29 @@
objectInTransaction = molder.newInstance(_db
.getClassLoader());
}
+
+ proposedObject.setProposedClass(objectInTransaction.getClass());
+ proposedObject.setActualClass(objectInTransaction.getClass());
+ proposedObject.setObject(objectInTransaction);
}
_tracker.trackObject(engine, molder, oid, objectInTransaction);
- OID newoid = engine.load(this, oid, objectInTransaction,
+ OID newoid = engine.load(this, oid, proposedObject,
suggestedAccessMode, _lockTimeout, results);
-
- // rehash the object entry, because oid might have changed!
- _tracker.trackOIDChange(objectInTransaction, engine, oid, newoid);
-
+
+ if (proposedObject.isExpanded()) {
+ // Remove old OID from ObjectTracker
+ _tracker.untrackObject(objectInTransaction);
+ // Create new OID
+ OID newOID = new OID(engine, proposedObject.getActualClassMolder(), identity);
+ // Add new OID to ObjectTracker
+ _tracker.trackObject(engine, molder, oid, proposedObject.getObject());
+ objectInTransaction = proposedObject.getObject();
+ } else {
+ // rehash the object entry, because oid might have changed!
+ _tracker.trackOIDChange(objectInTransaction, engine, oid, newoid);
+ }
+
} catch (ObjectNotFoundException except) {
_tracker.untrackObject(objectInTransaction);
throw except;
Index: main/org/exolab/castor/jdo/drivers/ConnectionProxy.java
===================================================================
RCS file: /scm/castor/castor/src/main/org/exolab/castor/jdo/drivers/ConnectionProxy.java,v
retrieving revision 1.1
diff -u -r1.1 ConnectionProxy.java
--- main/org/exolab/castor/jdo/drivers/ConnectionProxy.java 3 May 2005 15:26:47 -0000 1.1
+++ main/org/exolab/castor/jdo/drivers/ConnectionProxy.java 15 Jul 2005 21:47:04 -0000
@@ -22,16 +22,18 @@
*/
public class ConnectionProxy implements java.sql.Connection {
- /**
- * Default calling location, equals 'unknwon'.
- */
+ /** Default calling location, equals 'unknwon'. */
private static final String DEFAULT_CALLED_BY = "unknown";
- /**
- * Jakarta Common Log instance.
- */
+ /** Jakarta Common Log instance. */
private static final Log _log = LogFactory.getLog(ConnectionProxy.class);
+ /** Has property of LocalConfiguration been read? */
+ private static boolean _isConfigured = false;
+
+ /** Should connections been wrapped by a proxy? */
+ private static boolean _useProxies = false;
+
/**
* The JDBC Connection instance to proxy.
*/
@@ -47,15 +49,8 @@
* @param connection The JDBC connection to proxy.
* @return The JDBC connection proxy.
*/
- public static Connection newConnectionProxy (Connection connection) {
- boolean useProxies = Boolean.getBoolean(LocalConfiguration.getInstance().getProperty("org.exolab.castor.persist.useProxies", "true"));
-
- if (useProxies) {
- return new ConnectionProxy (connection, DEFAULT_CALLED_BY);
- }
-
- return connection;
-
+ public static Connection newConnectionProxy(Connection connection) {
+ return newConnectionProxy(connection, DEFAULT_CALLED_BY);
}
/**
@@ -64,8 +59,19 @@
* @param calledBy Name of the class using creating and this proxy class.
* @return The JDBC connection proxy.
*/
- public static ConnectionProxy newConnectionProxy (Connection connection, String calledBy) {
- return new ConnectionProxy (connection, calledBy);
+ public static Connection newConnectionProxy(Connection connection, String calledBy) {
+ if (!_isConfigured) {
+ String propertyValue = LocalConfiguration.getInstance().getProperty(
+ "org.exolab.castor.persist.useProxies", "true");
+ _useProxies = Boolean.valueOf(propertyValue).booleanValue();
+ _isConfigured = true;
+ }
+
+ if (!_useProxies) {
+ return connection;
+ } else {
+ return new ConnectionProxy(connection, calledBy);
+ }
}
/**
Index: main/org/exolab/castor/jdo/drivers/MultiRSCallQuery.java
===================================================================
RCS file: /scm/castor/castor/src/main/org/exolab/castor/jdo/drivers/MultiRSCallQuery.java,v
retrieving revision 1.4
diff -u -r1.4 MultiRSCallQuery.java
--- main/org/exolab/castor/jdo/drivers/MultiRSCallQuery.java 25 Mar 2004 12:31:06 -0000 1.4
+++ main/org/exolab/castor/jdo/drivers/MultiRSCallQuery.java 15 Jul 2005 21:47:05 -0000
@@ -54,6 +54,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.castor.persist.ProposedObject;
import org.exolab.castor.jdo.ObjectNotFoundException;
import org.exolab.castor.jdo.PersistenceException;
import org.exolab.castor.jdo.QueryException;
@@ -235,10 +236,9 @@
}
- public Object fetch(Object[] fields,Object identity) throws ObjectNotFoundException, PersistenceException
- {
- Object stamp = null;
-
+ public Object fetch(ProposedObject proposedObject, Object identity)
+ throws ObjectNotFoundException, PersistenceException {
+ Object[] fields = proposedObject.getFields();
try {
// Load all the fields of the object including one-one relations
// index 0 belongs to the identity
@@ -251,7 +251,7 @@
} catch ( SQLException except ) {
throw new PersistenceException( Messages.format( "persist.nested", except ) );
}
- return stamp;
+ return null;
}
}
Index: main/org/exolab/castor/jdo/drivers/PostgreSQLCallQuery.java
===================================================================
RCS file: /scm/castor/castor/src/main/org/exolab/castor/jdo/drivers/PostgreSQLCallQuery.java,v
retrieving revision 1.4
diff -u -r1.4 PostgreSQLCallQuery.java
--- main/org/exolab/castor/jdo/drivers/PostgreSQLCallQuery.java 25 Mar 2004 12:32:01 -0000 1.4
+++ main/org/exolab/castor/jdo/drivers/PostgreSQLCallQuery.java 15 Jul 2005 21:47:05 -0000
@@ -54,6 +54,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.castor.persist.ProposedObject;
import org.exolab.castor.jdo.ObjectNotFoundException;
import org.exolab.castor.jdo.PersistenceException;
import org.exolab.castor.jdo.QueryException;
@@ -248,12 +249,10 @@
}
- public Object fetch(Object[] fields,Object identity) throws ObjectNotFoundException, PersistenceException
- {
- Object stamp = null;
-
+ public Object fetch(ProposedObject proposedObject, Object identity)
+ throws ObjectNotFoundException, PersistenceException {
+ Object[] fields = proposedObject.getFields();
try {
-
// Load all the fields of the object including one-one relations
// index 0 belongs to the identity
for ( int i = 1 ; i < _sqlTypes.length ; ++i )
@@ -265,7 +264,7 @@
} catch ( SQLException except ) {
throw new PersistenceException( Messages.format( "persist.nested", except ) );
}
- return stamp;
+ return null;
}
}
Index: main/org/exolab/castor/jdo/drivers/PreparedStatementProxy.java
===================================================================
RCS file: /scm/castor/castor/src/main/org/exolab/castor/jdo/drivers/PreparedStatementProxy.java,v
retrieving revision 1.1
diff -u -r1.1 PreparedStatementProxy.java
--- main/org/exolab/castor/jdo/drivers/PreparedStatementProxy.java 3 May 2005 15:26:47 -0000 1.1
+++ main/org/exolab/castor/jdo/drivers/PreparedStatementProxy.java 15 Jul 2005 21:47:07 -0000
@@ -36,34 +36,28 @@
*/
public class PreparedStatementProxy implements PreparedStatement {
- /**
- * Commons logger.
- */
+ /** Commons logger. */
private static final Log log = LogFactory.getLog (PreparedStatementProxy.class);
- /**
- * PreparedStatement to be proxied.
- */
+ /** Has property of LocalConfiguration been read? */
+ private static boolean _isConfigured = false;
+
+ /** Should connections been wrapped by a proxy? */
+ private static boolean _useProxies = false;
+
+ /** PreparedStatement to be proxied. */
private PreparedStatement preparedStatement;
- /**
- * Connection instance associated with this PreparedStatement
- */
+ /** Connection instance associated with this PreparedStatement */
private Connection connection;
- /**
- * SQL Parameter mapping
- */
+ /** SQL Parameter mapping */
private Map parameters = new HashMap();
- /**
- * The SQL statement to be executed
- */
+ /** The SQL statement to be executed */
private String sqlStatement = null;
- /**
- * List of batch statements associated with this instance.
- */
+ /** List of batch statements associated with this instance. */
private List batchStatements = new ArrayList();
/**
@@ -73,14 +67,21 @@
* @param connection JDBC connection
* @return Prepared statement proxy.
*/
- public static PreparedStatement newPreparedStatementProxy (PreparedStatement statement, String sql, Connection connection) {
- boolean useProxies = Boolean.getBoolean(LocalConfiguration.getInstance().getProperty("org.exolab.castor.persist.useProxies", "true"));
+ public static PreparedStatement newPreparedStatementProxy(
+ PreparedStatement statement, String sql, Connection connection) {
+
+ if (!_isConfigured) {
+ String propertyValue = LocalConfiguration.getInstance().getProperty(
+ "org.exolab.castor.persist.useProxies", "true");
+ _useProxies = Boolean.valueOf(propertyValue).booleanValue();
+ _isConfigured = true;
+ }
- if (useProxies) {
- return new PreparedStatementProxy (statement, sql, connection);
- }
-
- return statement;
+ if (!_useProxies) {
+ return statement;
+ } else {
+ return new PreparedStatementProxy(statement, sql, connection);
+ }
}
/**
Index: main/org/exolab/castor/jdo/drivers/ReturnedRSCallQuery.java
===================================================================
RCS file: /scm/castor/castor/src/main/org/exolab/castor/jdo/drivers/ReturnedRSCallQuery.java,v
retrieving revision 1.3
diff -u -r1.3 ReturnedRSCallQuery.java
--- main/org/exolab/castor/jdo/drivers/ReturnedRSCallQuery.java 25 Mar 2004 12:24:22 -0000 1.3
+++ main/org/exolab/castor/jdo/drivers/ReturnedRSCallQuery.java 15 Jul 2005 21:47:07 -0000
@@ -54,6 +54,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.castor.persist.ProposedObject;
import org.exolab.castor.jdo.ObjectNotFoundException;
import org.exolab.castor.jdo.PersistenceException;
import org.exolab.castor.jdo.QueryException;
@@ -228,12 +229,10 @@
}
- public Object fetch(Object[] fields,Object identity) throws ObjectNotFoundException, PersistenceException
- {
- Object stamp = null;
-
+ public Object fetch(ProposedObject proposedObject, Object identity)
+ throws ObjectNotFoundException, PersistenceException {
+ Object[] fields = proposedObject.getFields();
try {
-
// Load all the fields of the object including one-one relations
// index 0 belongs to the identity
for ( int i = 1 ; i < _sqlTypes.length ; ++i )
@@ -245,7 +244,7 @@
} catch ( SQLException except ) {
throw new PersistenceException( Messages.format( "persist.nested", except ) );
}
- return stamp;
+ return null;
}
}
Index: main/org/exolab/castor/jdo/engine/BaseFactory.java
===================================================================
RCS file: /scm/castor/castor/src/main/org/exolab/castor/jdo/engine/BaseFactory.java,v
retrieving revision 1.3
diff -u -r1.3 BaseFactory.java
--- main/org/exolab/castor/jdo/engine/BaseFactory.java 19 Jan 2004 11:52:47 -0000 1.3
+++ main/org/exolab/castor/jdo/engine/BaseFactory.java 15 Jul 2005 21:47:08 -0000
@@ -47,6 +47,9 @@
package org.exolab.castor.jdo.engine;
+import java.util.HashMap;
+import java.util.Map;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.exolab.castor.mapping.ClassDescriptor;
@@ -73,17 +76,27 @@
* Commons Logging instance used for all logging.
*/
private static Log _log = LogFactory.getFactory().getInstance( BaseFactory.class );
+
+ /**
+ * Maps class descriptor to persistence engines ....
+ */
+ private Map classDescriptorToPersistence = new HashMap();
-
- public Persistence getPersistence( ClassDescriptor clsDesc )
- throws MappingException
- {
- if ( ! ( clsDesc instanceof JDOClassDescriptor ) )
- return null;
+ /**
+ * @see org.exolab.castor.persist.spi.PersistenceFactory#getPersistence(org.exolab.castor.mapping.ClassDescriptor)
+ */
+ public Persistence getPersistence(final ClassDescriptor clsDesc) {
+ if (!(clsDesc instanceof JDOClassDescriptor)) { return null; }
+
try {
- return new SQLEngine( (JDOClassDescriptor) clsDesc, this, null);
- } catch ( MappingException except ) {
- _log.fatal( Messages.format( "jdo.fatalException", except ) );
+ Persistence sqlEngine = (SQLEngine) classDescriptorToPersistence.get(clsDesc);
+ if (sqlEngine == null) {
+ sqlEngine = new SQLEngine((JDOClassDescriptor) clsDesc, this, null);
+ classDescriptorToPersistence.put(clsDesc, sqlEngine);
+ }
+ return sqlEngine;
+ } catch (MappingException except) {
+ _log.fatal(Messages.format("jdo.fatalException", except));
return null;
}
}
Index: main/org/exolab/castor/jdo/engine/DatabaseImpl.java
===================================================================
RCS file: /scm/castor/castor/src/main/org/exolab/castor/jdo/engine/DatabaseImpl.java,v
retrieving revision 1.25
diff -u -r1.25 DatabaseImpl.java
--- main/org/exolab/castor/jdo/engine/DatabaseImpl.java 20 Jun 2005 12:00:55 -0000 1.25
+++ main/org/exolab/castor/jdo/engine/DatabaseImpl.java 15 Jul 2005 21:47:09 -0000
@@ -54,6 +54,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.castor.persist.ProposedObject;
import org.castor.persist.TransactionContext;
import org.exolab.castor.jdo.*;
import org.exolab.castor.mapping.AccessMode;
@@ -343,7 +344,8 @@
TransactionContext tx = getTransaction();
PersistenceInfo info = _scope.getPersistenceInfo(type);
- return tx.load(info.engine, info.molder, identity, object, mode);
+ ProposedObject proposedObject = new ProposedObject();
+ return tx.load( info.engine, info.molder, identity, proposedObject, mode );
}
public void create( Object object )
Index: main/org/exolab/castor/jdo/engine/SQLEngine.java
===================================================================
RCS file: /scm/castor/castor/src/main/org/exolab/castor/jdo/engine/SQLEngine.java,v
retrieving revision 1.31
diff -u -r1.31 SQLEngine.java
--- main/org/exolab/castor/jdo/engine/SQLEngine.java 16 Jun 2005 12:14:28 -0000 1.31
+++ main/org/exolab/castor/jdo/engine/SQLEngine.java 15 Jul 2005 21:47:19 -0000
@@ -49,8 +49,10 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+
+import org.castor.engine.CounterRef;
+import org.castor.persist.ProposedObject;
import org.exolab.castor.jdo.*;
-import org.exolab.castor.jdo.drivers.PreparedStatementProxy;
import org.exolab.castor.mapping.*;
import org.exolab.castor.mapping.loader.FieldHandlerImpl;
import org.exolab.castor.persist.spi.*;
@@ -117,7 +119,7 @@
private ColumnInfo[] _ids;
private SQLEngine _extends;
-
+
private QueryExpression _sqlFinder;
private PersistenceFactory _factory;
@@ -142,6 +144,16 @@
*/
private boolean hasFieldsToPersist = false;
+ /**
+ * Number of ClassDescriptor that extend this one.
+ */
+ private int _numberOfExtendLevels;
+
+ /**
+ * Collection of all the ClassDescriptor that extend this one (closure)
+ */
+ private Collection _extendingClassDescriptors;
+
SQLEngine( JDOClassDescriptor clsDesc, PersistenceFactory factory, String stampField )
throws MappingException {
@@ -293,6 +305,10 @@
_fields = new FieldInfo[fieldsInfo.size()];
fieldsInfo.copyInto( _fields );
+ // obtain the number of ClassDescriptor that extend this one.
+ _numberOfExtendLevels = numberOfExtendingClassDescriptors(getDescriptor());
+ _extendingClassDescriptors = getDescriptor().getExtendedBy();
+
// iterate through all fields to check whether there is a field
// to persist at all; in the case of extend relationships where no
// additional attributes are defined in the extending class, this
@@ -327,6 +343,10 @@
}
}
+ public Persistence.ColumnInfo[] getColumnInfoForIdentities() {
+ return _ids;
+ }
+
public Persistence.FieldInfo[] getInfo() {
return _fields;
}
@@ -941,7 +961,7 @@
if(_log.isDebugEnabled()) {
_log.debug( Messages.format( "jdo.storing", _clsDesc.getJavaClass().getName(),
- _sqlLoad ) );
+ stmt.toString() ) );
}
// bind the identity to the prepareStatement
@@ -964,15 +984,20 @@
for(int i = 0; i < fields.length; i++){
currentField = toJava(i, 0, res.getObject(_fields[i].columns[0].name));
- if ( currentField != null &&
- _fields[i].tableName.compareTo(_mapTo) == 0 &&
- !original[i].equals(currentField) ) {
- if (numberOfFieldsNotMatching >= 1) {
- enlistFieldsNotMatching.append (", ");
+ if (_fields[i].tableName.compareTo(_mapTo) == 0) {
+ if ((original[i] == null && currentField != null) ||
+ (currentField == null && original[i] != null) ||
+ (original[i] == null && currentField == null)) {
+ enlistFieldsNotMatching.append ("(" + _clsDesc.getJavaClass().getName() + ")." + _fields[i].columns[0].name + ": ");
+ enlistFieldsNotMatching.append ("[" + original[i] + "/" + currentField + "]");
+ } else if (!original[i].equals(currentField) ) {
+ if (numberOfFieldsNotMatching >= 1) {
+ enlistFieldsNotMatching.append (", ");
+ }
+ enlistFieldsNotMatching.append ("(" + _clsDesc.getJavaClass().getName() + ")." + _fields[i].columns[0].name + ": ");
+ enlistFieldsNotMatching.append ("[" + original[i] + "/" + currentField + "]");
+ numberOfFieldsNotMatching++;
}
- enlistFieldsNotMatching.append ("(" + _clsDesc.getJavaClass().getName() + ")." + _fields[i].columns[0].name + ": ");
- enlistFieldsNotMatching.append ("[" + original[i] + "/" + currentField + "]");
- numberOfFieldsNotMatching++;
}
}
throw new ObjectModifiedException( Messages.format("persist.objectModified", _clsDesc.getJavaClass().getName(), identity, enlistFieldsNotMatching.toString()) );
@@ -1106,25 +1131,42 @@
}
- public Object load( Object conn, Object[] fields, Object identity, AccessMode accessMode )
- throws ObjectNotFoundException, PersistenceException {
-
+ /**
+ * Loads the object from persistence storage. This method will load
+ * the object fields from persistence storage based on the object's
+ * identity. This method may return a stamp which can be used at a
+ * later point to determine whether the copy of the object in
+ * persistence storage is newer than the cached copy (see {@link
+ * #store}). If lock is true the object must be
+ * locked in persistence storage to prevent concurrent updates.
+ *
+ * @param conn An open connection
+ * @param fields An Object[] to load field values into
+ * @param identity Identity of the object to load.
+ * @param accessMode The access mode (null equals shared)
+ * @return The object's stamp, or null
+ * @throws ObjectNotFoundException The object was not found in persistent storage
+ * @throws PersistenceException A persistence error occured
+ */
+ public Object load( Object conn, ProposedObject proposedObject, Object identity, AccessMode accessMode )
+ throws ObjectNotFoundException, PersistenceException {
PreparedStatement stmt = null;
ResultSet rs = null;
Object stamp = null;
boolean notNull;
+
+ Object[] fields = proposedObject.getFields();
+
try {
- String sql = ( accessMode == AccessMode.DbLocked ) ? _sqlLoadLock : _sqlLoad;
- stmt = ( (Connection) conn ).prepareStatement(sql);
-
+ String sqlString = (accessMode == AccessMode.DbLocked) ? _sqlLoadLock : _sqlLoad;
+ stmt = ((Connection) conn).prepareStatement(sqlString);
+
if (_log.isDebugEnabled()) {
- String generatedSQL = ( accessMode == AccessMode.DbLocked ) ? _sqlLoadLock : _sqlLoad;
-// _log.debug( Messages.format( "jdo.loading", _clsDesc.getJavaClass().getName(), generatedSQL ) );
- _log.debug( Messages.format( "jdo.loading", _clsDesc.getJavaClass().getName(), stmt.toString()) );
+ _log.debug( Messages.format("jdo.loading", _clsDesc.getJavaClass().getName(), stmt.toString()));
}
- int count = 1;
+ int fieldIndex = 1;
// bind the identity of the preparedStatement
if ( identity instanceof Complex ) {
Complex id = (Complex) identity;
@@ -1132,37 +1174,67 @@
throw new PersistenceException( "Size of complex field mismatched! expected: "+_ids.length+" found: "+id.size() );
for ( int i=0; i<_ids.length; i++ )
- stmt.setObject( count++, idToSQL( i, id.get(i) ) );
-
+ stmt.setObject(fieldIndex++, idToSQL(i, id.get(i)));
} else {
if ( _ids.length != 1 )
throw new PersistenceException( "Complex field expected!" );
- stmt.setObject( count++, idToSQL( 0, identity ) );
+ stmt.setObject(fieldIndex++, idToSQL(0, identity));
}
if (_log.isDebugEnabled()) {
_log.debug( Messages.format( "jdo.loading", _clsDesc.getJavaClass().getName(), stmt.toString()) );
}
- // query the object
+ // execute the SQL query
rs = stmt.executeQuery();
if ( ! rs.next() )
throw new ObjectNotFoundException( Messages.format("persist.objectNotFound", _clsDesc.getJavaClass().getName(), identity) );
+ if (_extendingClassDescriptors.size() > 0) {
+ Object[] returnValues =
+ calculateNumberOfFields(_extendingClassDescriptors,
+ _ids.length, _fields.length, _numberOfExtendLevels, rs);
+ JDOClassDescriptor potentialLeafDescriptor = (JDOClassDescriptor) returnValues[0];
+
+ if (potentialLeafDescriptor != null &&
+ !potentialLeafDescriptor.getJavaClass().getName().equals (getDescriptor().getJavaClass().getName())) {
+ Object[] expandedFields = new Object[potentialLeafDescriptor.getFields().length];
+
+ fields = expandedFields;
+ proposedObject.setFields (expandedFields);
+ proposedObject.setActualClass (potentialLeafDescriptor.getJavaClass());
+ proposedObject.setExpanded(true);
+ }
+
+ return null;
+ }
+
// Load all the fields of the object including one-one relations
- count = 1;
+ // index to use during ResultSet.getXXX()
+ int columnIndex = 1;
+ // index in fields[] for storing result of SQLTypes.getObject()
+ fieldIndex = 1;
+ String tableName = null;
+ String tableNameOld = tableName;
Object[] temp = new Object[10]; // assume complex field max at 10
- for ( int i = 0 ; i < _fields.length ; ++i ) {
+ for (int i = 0 ; i < _fields.length ; ++i ) {
+ tableName = _fields[i].tableName;
+ if (!tableName.equals (tableNameOld) && !_fields[i].joined) {
+ columnIndex = columnIndex + _ids.length;
+ }
+
if ( !_fields[i].load )
continue;
if ( !_fields[i].multi ) {
notNull = false;
if ( _fields[i].columns.length == 1 ) {
- fields[i] = toJava( i, 0, SQLTypes.getObject( rs, count++, _fields[i].columns[0].sqlType ) );
+ fields[i] = toJava(i, 0, SQLTypes.getObject(rs, columnIndex++, _fields[i].columns[0].sqlType));
+ fieldIndex++;
} else {
- for ( int j=0; j<_fields[i].columns.length; j++ ) {
- temp[j] = toJava( i, j, SQLTypes.getObject( rs, count++, _fields[i].columns[j].sqlType ) );
+ for (int j = 0; j < _fields[i].columns.length; j++) {
+ temp[j] = toJava(i, j, SQLTypes.getObject(rs, columnIndex++, _fields[i].columns[j].sqlType));
+ fieldIndex++;
if ( temp[j] != null ) {
notNull = true;
}
@@ -1176,11 +1248,12 @@
ArrayList res = new ArrayList();
notNull = false;
for ( int j=0; j<_fields[i].columns.length; j++ ) {
- temp[j] = toJava( i, j, SQLTypes.getObject( rs, count, _fields[i].columns[j].sqlType ) );
+ temp[j] = toJava(i, j, SQLTypes.getObject(rs, columnIndex, _fields[i].columns[j].sqlType));
if ( temp[j] != null ) {
notNull = true;
}
- count++;
+ fieldIndex++;
+ columnIndex++;
}
if ( notNull ) {
if ( _fields[i].columns.length == 1 )
@@ -1190,24 +1263,36 @@
}
fields[i] = res;
}
+
+ tableNameOld = tableName;
}
- while ( rs.next() ) {
- count = 1;
- for ( int i = 0; i < _fields.length ; ++i ) {
- if ( !_fields[i].load )
+ while (rs.next()) {
+ fieldIndex = 1;
+ columnIndex = 1;
+
+ tableName = null;
+ tableNameOld = tableName;
+
+ for (int i = 0; i < _fields.length ; ++i) {
+
+ tableName = _fields[i].tableName;
+ if (!tableName.equals (tableNameOld) && !_fields[i].joined) {
+ columnIndex = columnIndex + _ids.length;
+ }
+
+ if ( !_fields[i].load )
continue;
if ( _fields[i].multi ) {
ArrayList res = (ArrayList)fields[i];
notNull = false;
- for ( int j=0; j<_fields[i].columns.length; j++ ) {
- temp[j] = toJava( i, j, SQLTypes.getObject( rs, count, _fields[i].columns[j].sqlType ) );
- if ( temp[j] != null ) {
- notNull = true;
- }
- count++;
+ for (int j = 0; j < _fields[i].columns.length; j++) {
+ temp[j] = toJava(i, j, SQLTypes.getObject(rs, columnIndex, _fields[i].columns[j].sqlType));
+ if (temp[j] != null) { notNull = true; }
+ columnIndex++;
}
+ fieldIndex++;
if ( notNull ) {
if ( _fields[i].columns.length == 1 ) {
if ( !res.contains( temp[0] ) )
@@ -1219,29 +1304,120 @@
}
}
} else {
- count += _fields[i].columns.length;
+ fieldIndex++;
+ columnIndex += _fields[i].columns.length;
}
+ tableNameOld = tableName;
}
+
+ proposedObject.setFields(fields);
}
} catch ( SQLException except ) {
_log.fatal( Messages.format( "jdo.loadFatal", _type, (( accessMode == AccessMode.DbLocked ) ? _sqlLoadLock : _sqlLoad ) ), except );
-
- throw new PersistenceException( Messages.format("persist.nested", except), except );
+ throw new PersistenceException(Messages.format("persist.nested", except), except);
} finally {
- try {
- if ( rs != null ) rs.close();
- } catch ( SQLException sqle ) {
- _log.warn("Problem closing JDBC Connection instance", sqle);
+ Utils.closeResultSet(rs);
+ Utils.closeStatement(stmt);
+ }
+ return stamp;
+ }
+
+ private int numberOfExtendingClassDescriptors (JDOClassDescriptor classDescriptor) {
+ int numberOfExtendLevels = 1;
+ JDOClassDescriptor currentClassDescriptor = getDescriptor();
+ while (currentClassDescriptor.getExtends() != null) {
+ currentClassDescriptor = (JDOClassDescriptor) currentClassDescriptor.getExtends();
+ numberOfExtendLevels++;
+ }
+ return numberOfExtendLevels;
+ }
+
+ private Object[] calculateNumberOfFields (Collection extendingClassDescriptors,
+ int numberOfIdentityColumns,
+ int numberOfFields,
+ int numberOfExtendLevels,
+ ResultSet rs)
+ throws SQLException
+ {
+ JDOClassDescriptor potentialLeafDescriptor = null;
+ int suggestedNumberOfFields = numberOfFields;
+ Collection potentialActualClassDescriptor = new LinkedList();
+ int numberOfIdentitiesToAnalyze = 0;
+ addExtendingClassDescriptors(potentialActualClassDescriptor, extendingClassDescriptors);
+
+ JDOClassDescriptor potentialClassDescriptor = null;
+ JDOClassDescriptor potentialClassDescriptorPrevious = null;
+ int initialColumnIndex = numberOfFields + numberOfIdentityColumns * numberOfExtendLevels + 1;
+ int columnIndex = initialColumnIndex;
+ int numberOfExtendingClassDescriptors = 0;
+ for (Iterator iter = potentialActualClassDescriptor.iterator(); iter.hasNext(); ) {
+ potentialClassDescriptor = (JDOClassDescriptor) iter.next();
+ numberOfExtendingClassDescriptors += 1;
+ _log.debug ("Potential extending class descriptor: " + potentialClassDescriptor.getJavaClass().getName());
+ FieldDescriptor[] identityDescriptors = potentialClassDescriptor.getIdentities();
+ boolean isNull = true;
+
+ for (int i = 0; i < identityDescriptors.length; i++) {
+ Object temp;
+ Object[] temps;
+ JDOFieldDescriptor jdoFieldDescriptor = (JDOFieldDescriptor) identityDescriptors[i];
+ if (jdoFieldDescriptor.getSQLName().length == 1 ) {
+ temp = SQLTypes.getObject( rs, columnIndex++, java.sql.Types.JAVA_OBJECT);
+ isNull = (temp == null);
+ } else {
+ temps = new Object[jdoFieldDescriptor.getSQLName().length];
+ for ( int j=0; j 0) {
+ potentialLeafDescriptor = potentialClassDescriptor;
+ suggestedNumberOfFields += potentialClassDescriptor.getFields().length;
+ } else if (!iter.hasNext() && isNull && numberOfIdentitiesToAnalyze > 0){
+ potentialLeafDescriptor = potentialClassDescriptorPrevious;
+ // suggestedNumberOfFields += potentialClassDescriptor.getFields().length;
+ } else {
+ FieldDescriptor[] potentialFields =
+ (FieldDescriptor[]) potentialClassDescriptor.getFields();
+ for (int i = 0; i < potentialFields.length; i++) {
+ JDOFieldDescriptor jdoFieldDescriptor = (JDOFieldDescriptor) potentialFields[i];
+ String[] columnNames = jdoFieldDescriptor.getSQLName();
+ columnIndex = columnIndex + columnNames.length;
+ }
+
+ // the JDOClassDescriptor we just looked at is definitely part of the extends hierarchy,
+ // and as such we need to increase the number of potential fields
+ if (!isNull) {
+ suggestedNumberOfFields += potentialClassDescriptor.getFields().length;
+ }
}
}
- return stamp;
+
+ _log.debug ("In total " + numberOfIdentitiesToAnalyze + " (extending) identities analyzed.");
+
+ if ((potentialLeafDescriptor != null) && _log.isDebugEnabled()) {
+ _log.debug ("Most likely of type " + potentialLeafDescriptor.getJavaClass().getName());
+ _log.debug ("After analysis, " + suggestedNumberOfFields + " fields need to be loaded.");
+ }
+
+ return new Object[] {potentialLeafDescriptor, new Integer (suggestedNumberOfFields) };
+
}
-
private void buildSqlCreate () throws QueryException {
StringBuffer sql;
@@ -1399,7 +1575,7 @@
}
- private void buildFinder( JDOClassDescriptor clsDesc ) throws QueryException {
+ private void buildFinder(JDOClassDescriptor clsDesc) throws QueryException {
QueryExpression expr;
QueryExpression find;
@@ -1427,14 +1603,27 @@
baseDesc.getTableName(), baseDesc.getIdentityColumnNames());
curDesc = baseDesc;
}
- for ( int i=0; i<_ids.length; i++ ) {
- find.addColumn( _mapTo, idnames[i] );
- }
-
+
// join all the related/depended table
Vector joinTables = new Vector();
- for ( int i=0; i<_fields.length; i++ ) {
- String alias = _fields[i].tableName;
+ String aliasOld = null;
+ String alias = null;
+
+ for (int i = 0; i < _fields.length; i++) {
+ if (i > 0) { aliasOld = alias; }
+ alias = _fields[i].tableName;
+
+ // add id columns to select statement
+ if (!alias.equals(aliasOld) && !_fields[i].joined) {
+ JDOClassDescriptor classDescriptor = (JDOClassDescriptor)
+ _fields[i].fieldDescriptor.getContainingClassDescriptor();
+ String[] ids = classDescriptor.getIdentityColumnNames();
+ for (int j = 0; j < ids.length; j++) {
+ expr.addColumn(alias, ids[j]);
+ find.addColumn(alias, ids[j]);
+ }
+ }
+
if ( _fields[i].load ) {
if ( _fields[i].joined /*&& !joinTables.contains( _fields[i].tableName )*/ ) {
int offset = 0;
@@ -1458,20 +1647,93 @@
expr.addColumn( alias, _fields[i].columns[j].name );
find.addColumn( alias, _fields[i].columns[j].name );
}
+
expr.addTable(_fields[i].tableName, alias);
find.addTable(_fields[i].tableName, alias);
}
}
+
+ // 'join' all the extending tables
+ curDesc = clsDesc;
+ List classDescriptorsToAdd = new LinkedList();
+ JDOClassDescriptor classDescriptor = null;
+ addExtendingClassDescriptors(classDescriptorsToAdd, curDesc.getExtendedBy());
+
+ if (classDescriptorsToAdd.size() > 0) {
+ for (Iterator iter = classDescriptorsToAdd.iterator(); iter.hasNext(); ) {
+ classDescriptor = (JDOClassDescriptor) iter.next();
+
+ if (_log.isDebugEnabled()) {
+ _log.debug("Adding outer left join for " + classDescriptor.getJavaClass().getName() +
+ " on table " + classDescriptor.getTableName());
+ }
+
+ expr.addOuterJoin( _mapTo,
+ curDesc.getIdentityColumnNames(),
+ classDescriptor.getTableName(),
+ classDescriptor.getIdentityColumnNames());
+ find.addOuterJoin( _mapTo,
+ curDesc.getIdentityColumnNames(),
+ classDescriptor.getTableName(),
+ classDescriptor.getIdentityColumnNames());
+
+ Persistence persistenceEngine;
+ try {
+ persistenceEngine = _factory.getPersistence (classDescriptor);
+ } catch (MappingException e) {
+ throw new QueryException("Problem obtaining persistence engine for ClassDescriptor " + classDescriptor.getJavaClass().getName(), e);
+ }
+
+ SQLEngine.ColumnInfo[] idInfos =
+ (SQLEngine.ColumnInfo[]) persistenceEngine.getColumnInfoForIdentities();
+ for (int i = 0; i < idInfos.length; i++) {
+ expr.addColumn (classDescriptor.getTableName(), idInfos[i].name);
+ find.addColumn (classDescriptor.getTableName(), idInfos[i].name);
+ }
+
+ SQLEngine.FieldInfo[] fieldInfos = (SQLEngine.FieldInfo[]) persistenceEngine.getInfo();
+ for (int i = 0; i < fieldInfos.length; i++) {
+ boolean hasFieldToAdd = false;
+ SQLEngine.ColumnInfo[] columnInfos = fieldInfos[i].columns;
+ if (classDescriptor.getTableName().equals(fieldInfos[i].tableName)) {
+ for ( int j = 0; j < columnInfos.length; j++ ) {
+ expr.addColumn (classDescriptor.getTableName(), fieldInfos[i].columns[j].name);
+ find.addColumn (classDescriptor.getTableName(), fieldInfos[i].columns[j].name);
+ }
+ hasFieldToAdd = true;
+ }
+
+ if (hasFieldToAdd) {
+ expr.addTable(classDescriptor.getTableName());
+ find.addTable(classDescriptor.getTableName());
+ }
+ }
+ }
+ }
+
+
_sqlLoad = expr.getStatement( false );
_sqlLoadLock = expr.getStatement( true );
_sqlFinder = find;
if(_log.isDebugEnabled()) {
- _log.debug( Messages.format( "jdo.loading", _type, _sqlLoad ) );
+ _log.debug(Messages.format("jdo.loading", _type, _sqlLoad));
+ _log.debug(Messages.format("jdo.loading.with.lock", _type, _sqlLoadLock));
+ _log.debug(Messages.format("jdo.finding", _type, _sqlFinder));
}
}
+
+ private void addExtendingClassDescriptors (Collection classDescriptorsToAdd, Collection extendingClassDescriptors) {
+ JDOClassDescriptor classDescriptor = null;
+ for (Iterator iter = extendingClassDescriptors.iterator(); iter.hasNext(); ) {
+ classDescriptor = (JDOClassDescriptor) iter.next();
+ classDescriptorsToAdd.add (classDescriptor);
+ addExtendingClassDescriptors(classDescriptorsToAdd, classDescriptor.getExtendedBy());
+ }
+
+ }
public String toString() {
@@ -1497,10 +1759,18 @@
final String[] joinFields;
ColumnInfo[] columns;
+
+ final FieldDescriptor fieldDescriptor;
+
+ final ClassDescriptor classDescriptor;
FieldInfo( JDOClassDescriptor clsDesc, FieldDescriptor fieldDesc, String classTable, boolean ext )
throws MappingException{
+ fieldDescriptor = fieldDesc;
+
+ classDescriptor = clsDesc;
+
// for readability
final int FIELD_TYPE = 0;
@@ -1645,16 +1915,31 @@
}
}
- static final class ColumnInfo {
+ static final class ColumnInfo implements Persistence.ColumnInfo{
+ /**
+ * Name of the column
+ */
final String name;
+ /**
+ * SQL type of teh coplumn
+ */
final int sqlType;
+ /**
+ * TypeConvertor to use when converting to the SQLType of this column.
+ */
final TypeConvertor convertTo;
+ /**
+ * TypeConvertor to use when converting from the SQLType of this column.
+ */
final TypeConvertor convertFrom;
+ /**
+ * Type conversion parameters
+ */
final String convertParam;
ColumnInfo( String name, int type, TypeConvertor convertTo,
@@ -1665,6 +1950,41 @@
this.convertFrom = convertFrom;
this.convertParam = convertParam;
}
+
+ /* (non-Javadoc)
+ * @see org.exolab.castor.persist.spi.Persistence.ColumnInfo#getName()
+ */
+ public String getName() {
+ return name;
+ }
+
+ /* (non-Javadoc)
+ * @see org.exolab.castor.persist.spi.Persistence.ColumnInfo#getSqlType()
+ */
+ public int getSqlType() {
+ return sqlType;
+ }
+
+ /* (non-Javadoc)
+ * @see org.exolab.castor.persist.spi.Persistence.ColumnInfo#getConvertTo()
+ */
+ public TypeConvertor getConvertTo() {
+ return convertTo;
+ }
+
+ /* (non-Javadoc)
+ * @see org.exolab.castor.persist.spi.Persistence.ColumnInfo#getConvertFrom()
+ */
+ public TypeConvertor getConvertFrom() {
+ return convertFrom;
+ }
+
+ /* (non-Javadoc)
+ * @see org.exolab.castor.persist.spi.Persistence.ColumnInfo#getConvertParam()
+ */
+ public String getConvertParam() {
+ return convertParam;
+ }
}
static final class SQLQuery implements PersistenceQuery {
@@ -1673,7 +1993,8 @@
private ResultSet _rs;
- private final SQLEngine _engine;
+ private /*final*/ SQLEngine _engine;
+ private SQLEngine _requestedEngine;
private final Class[] _types;
@@ -1692,6 +2013,7 @@
SQLQuery( SQLEngine engine, String sql, Class[] types )
{
_engine = engine;
+ _requestedEngine = engine;
_types = types;
_values = new Object[ _types.length ];
_sql = sql;
@@ -1749,7 +2071,7 @@
}
catch (SQLException e)
{
- throw new PersistenceException(e.getMessage());
+ throw new PersistenceException(e.getMessage(), e);
}
return retval;
}
@@ -1956,19 +2278,31 @@
}
- private Object loadSingleField( int i, int count ) throws SQLException, PersistenceException
- {
+ private Object loadSingleField(int i, CounterRef counterReference)
+ throws SQLException, PersistenceException {
+ String currentTableName = counterReference.getTableName();
+ int count = counterReference.getCounter();
Object[] temp = new Object[_engine._fields[i].columns.length];
boolean notNull = false;
Object field;
+
+ String fieldTableName = _engine._fields[i].tableName;
+ String firstColumnOfField = _engine._fields[i].columns[0].name;
+ ResultSetMetaData metaData = _rs.getMetaData();
+ while (!(firstColumnOfField.equalsIgnoreCase(metaData.getColumnName(count))
+ && (fieldTableName.equalsIgnoreCase(metaData.getTableName(count))
+ || "".equals(metaData.getTableName(count))))) {
+ count++;
+ }
+
if ( _engine._fields[i].columns.length == 1 ) {
- field = _engine.toJava( i, 0, SQLTypes.getObject( _rs, count++,
- _engine._fields[i].columns[0].sqlType ) );
+ field = _engine.toJava(i, 0, SQLTypes.getObject(_rs, count, _engine._fields[i].columns[0].sqlType));
+ count++;
} else {
for ( int j=0; j<_engine._fields[i].columns.length; j++ ) {
- temp[j] = _engine.toJava( i, j, SQLTypes.getObject( _rs, count++,
- _engine._fields[i].columns[j].sqlType ) );
+ temp[j] = _engine.toJava(i, j, SQLTypes.getObject(_rs, count, _engine._fields[i].columns[j].sqlType));
+ count++;
if ( temp[j] != null ) {
notNull = true;
}
@@ -1978,24 +2312,36 @@
else
field = null;
}
+ counterReference.setCounter(count);
+ counterReference.setTableName(currentTableName);
return field;
}
- private Object loadMultiField( int i, int count, Object field ) throws SQLException, PersistenceException
- {
+ private Object loadMultiField(int i, CounterRef counterReference, Object field)
+ throws SQLException, PersistenceException {
+ int count = counterReference.getCounter();
Object[] temp = new Object[_engine._fields[i].columns.length];
boolean notNull = false;
ArrayList res;
+ String fieldTableName = _engine._fields[i].tableName;
+ String firstColumnOfField = _engine._fields[i].columns[0].name;
+
+ ResultSetMetaData metaData = _rs.getMetaData();
+ while (!(firstColumnOfField.equalsIgnoreCase(metaData.getColumnName(count))
+ && (fieldTableName.equalsIgnoreCase(metaData.getTableName(count))
+ || "".equals(metaData.getTableName(count))))) {
+ count++;
+ }
+
if( field == null )
res = new ArrayList();
else
res = (ArrayList) field;
for ( int j=0; j<_engine._fields[i].columns.length; j++ ) {
- temp[j] = _engine.toJava( i, j,
- SQLTypes.getObject( _rs, count, _engine._fields[i].columns[j].sqlType ) );
+ temp[j] = _engine.toJava(i, j, SQLTypes.getObject(_rs, count, _engine._fields[i].columns[j].sqlType));
if ( temp[j] != null ) {
notNull = true;
}
@@ -2011,27 +2357,41 @@
res.add( com );
}
}
+ counterReference.setCounter(count);
+
return res;
}
-
- private int loadRow( Object[] fields, boolean isFirst ) throws SQLException, PersistenceException
- {
+ private int loadRow(Object[] fields, int numberOfFields, boolean isFirst)
+ throws SQLException, PersistenceException {
int count = _engine._ids.length + 1;
- // Load all the fields.
- for ( int i = 0 ; i < _engine._fields.length ; ++i ) {
- if ( !_engine._fields[i].load )
- continue;
+ String tableName = null;
- if ( _engine._fields[i].multi ) {
- fields[i] = loadMultiField( i, count, fields[i] );
- } else if( isFirst ) {
- // Non-multi fields have to be done one only once, so this is skipped
- // if we have already read the first row.
- fields[i] = loadSingleField( i, count );
+ // TODO: wrong, as it could be that the first field is not part of the root class.
+ if (numberOfFields > 0) {
+ tableName = _engine._fields[0].tableName;
+
+ // Load all the fields.
+ CounterRef counterReference = new CounterRef ();
+ counterReference.setCounter(count);
+ counterReference.setTableName(tableName);
+
+ for ( int i = 0 ; i < numberOfFields ; ++i ) {
+ if (!_engine._fields[i].load) { continue; }
+
+ if ( _engine._fields[i].multi ) {
+ counterReference.setCounter(count);
+ fields[i] = loadMultiField( i, counterReference, fields[i] );
+ count = counterReference.getCounter();
+ } else if( isFirst ) {
+ // Non-multi fields have to be done one only once, so this is skipped
+ // if we have already read the first row.
+ counterReference.setCounter (count);
+ fields[i] = loadSingleField( i, counterReference);
+ count = counterReference.getCounter();
+ }
}
- count += _engine._fields[i].columns.length;
}
return count;
}
@@ -2064,12 +2424,18 @@
}
- // Fill the given fields[] with the "cached" stuff from our _fields[] .
- public Object fetch( Object[] fields, Object identity ) throws ObjectNotFoundException, PersistenceException
- {
+ /**
+ * @see org.exolab.castor.persist.spi.PersistenceQuery#fetch(org.exolab.castor.persist.ProposedObject, java.lang.Object)
+ */
+ public Object fetch(ProposedObject proposedObject, Object identity)
+ throws ObjectNotFoundException, PersistenceException {
+ Object[] fields = proposedObject.getFields();
+
+ // Fill the given fields[] with the "cached" stuff from our _fields[] .
for( int i = 0; i < _fields.length; i++ ) {
fields[i] = _fields[i];
}
+
return null;
}
@@ -2079,7 +2445,40 @@
// maybe we can optimize a little bit here when we have time.
// Instead of creating new Object[] and ArrayList for each
// "multi field" each fetchRaw is called, we might reuse them.
- _fields = new Object[_engine._fields.length];
+
+ SQLEngine oldEngine = null;
+ int originalFieldNumber = _requestedEngine._fields.length;
+ if (_requestedEngine.getDescriptor().isExtended()) {
+ Collection extendingClassDescriptors = _requestedEngine.getDescriptor().getExtendedBy();
+ int numberOfExtendLevels = _requestedEngine.numberOfExtendingClassDescriptors(_requestedEngine.getDescriptor());
+ JDOClassDescriptor leafDescriptor = null;
+ Object[] returnValues = null;
+ try {
+ returnValues =_requestedEngine.calculateNumberOfFields(extendingClassDescriptors, _requestedEngine._ids.length, _requestedEngine._fields.length, numberOfExtendLevels, this._rs);
+ } catch (SQLException e) {
+ _log.error ("Problem calculating number of concrete fields.", e);
+ throw new PersistenceException ("Problem calculating number of concrete fields.", e);
+ }
+
+ leafDescriptor = (JDOClassDescriptor) returnValues[0];
+
+ if (leafDescriptor != null) {
+ if (!leafDescriptor.getJavaClass().getName().equals(_requestedEngine.getDescriptor().getJavaClass().getName())) {
+ originalFieldNumber = ((Integer) returnValues[1]).intValue();
+
+ Persistence newEngine =null;
+ try {
+ newEngine = _requestedEngine._factory.getPersistence(leafDescriptor);
+ } catch (MappingException e) {
+ _log.error ("Problem obtaining persistence engine for " + leafDescriptor.getJavaClass().getName(), e);
+ throw new PersistenceException ("Problem obtaining persistence engine for " + leafDescriptor.getJavaClass().getName(), e);
+ }
+ _engine = (SQLEngine) newEngine;
+ }
+ }
+ }
+
+ _fields = new Object[originalFieldNumber];
// It would prove a little difficult to fetch if we don't have any rows with data left :-)
if ( _resultSetDone )
@@ -2102,7 +2501,7 @@
// As we assume that we have called fetch() immediatly after nextIdentity(),
// we can be sure that it belongs to the object we want. This is probably not the
// safest programming style, but has to suffice currently :-)
- loadRow( _fields, true );
+ loadRow(_fields, originalFieldNumber, true);
// We move forward in the ResultSet, until we see another identity or run out of rows.
while ( _rs.next() ) {
@@ -2114,7 +2513,7 @@
if( identitiesEqual( wantedIdentity, currentIdentity ) ) {
// Load next row of object data from _rs into <_fields> array.
- loadRow( _fields, false );
+ loadRow(_fields, originalFieldNumber, false);
} else {
// We are done with all the rows for our obj. and still have rows left.
@@ -2129,7 +2528,6 @@
// We are done with all the rows for our obj. and don't have any rows left.
_resultSetDone = true;
_lastIdentity = null;
-
} catch ( SQLException except ) {
throw new PersistenceException( Messages.format("persist.nested", except), except );
}
Index: main/org/exolab/castor/jdo/engine/SimpleQueryExecutor.java
===================================================================
RCS file: /scm/castor/castor/src/main/org/exolab/castor/jdo/engine/SimpleQueryExecutor.java,v
retrieving revision 1.6
diff -u -r1.6 SimpleQueryExecutor.java
--- main/org/exolab/castor/jdo/engine/SimpleQueryExecutor.java 3 May 2005 15:26:47 -0000 1.6
+++ main/org/exolab/castor/jdo/engine/SimpleQueryExecutor.java 15 Jul 2005 21:47:19 -0000
@@ -49,7 +49,6 @@
import org.exolab.castor.jdo.PersistenceException;
import org.exolab.castor.jdo.QueryException;
import org.exolab.castor.jdo.QueryResults;
-import org.exolab.castor.jdo.drivers.PreparedStatementProxy;
import org.exolab.castor.persist.spi.QueryExpression;
import org.exolab.castor.util.SqlBindParser;
Index: main/org/exolab/castor/mapping/loader/ClassDescriptorImpl.java
===================================================================
RCS file: /scm/castor/castor/src/main/org/exolab/castor/mapping/loader/ClassDescriptorImpl.java,v
retrieving revision 1.2
diff -u -r1.2 ClassDescriptorImpl.java
--- main/org/exolab/castor/mapping/loader/ClassDescriptorImpl.java 5 Mar 2005 13:41:52 -0000 1.2
+++ main/org/exolab/castor/mapping/loader/ClassDescriptorImpl.java 15 Jul 2005 21:47:20 -0000
@@ -47,6 +47,12 @@
package org.exolab.castor.mapping.loader;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedList;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.exolab.castor.mapping.ValidityException;
import org.exolab.castor.mapping.ClassDescriptor;
import org.exolab.castor.mapping.FieldDescriptor;
@@ -66,9 +72,9 @@
public class ClassDescriptorImpl
implements ClassDescriptor
{
+ private static final Log _log = LogFactory.getLog(ClassDescriptorImpl.class);
-
- private ClassMapping _map;
+ private ClassMapping _map;
/**
* The Java class for this descriptor.
*/
@@ -85,11 +91,15 @@
* or null if this is a top-level class.
*/
private final ClassDescriptor _extends;
-
+
+ /**
+ * A collection of class descriptors that extend this class, or
+ * an empty collection if this is a leaf class.
+ */
+ private final Collection _extendedBy = new LinkedList();
private final ClassDescriptor _depends;
-
/**
* The field of the identity for this class.
*/
@@ -166,6 +176,12 @@
throw new MappingException( "mapping.classDoesNotExtend",
_javaClass.getName(), extend.getJavaClass().getName() );
_extends = extend;
+
+ if ( _extends.getClass().getName().equals("org.exolab.castor.jdo.engine.JDOClassDescriptor") &&
+ this.getClass().getName().equals("org.exolab.castor.jdo.engine.JDOClassDescriptor")) {
+ ((ClassDescriptorImpl) _extends).addExtendedBy(this);
+ }
+
if ( _extends instanceof ClassDescriptorImpl )
_identities = ( identities == null ? ((ClassDescriptorImpl)_extends).getIdentities() : identities );
else
@@ -232,6 +248,27 @@
public ClassDescriptor getExtends()
{
return _extends;
+ }
+
+ public boolean isExtending() {
+ return (_extends != null);
+ }
+
+ /**
+ * Returns a collection of class descriptors that extend this class descriptor.
+ *
+ * @return A collection of class descriptors.
+ */
+ public Collection getExtendedBy() {
+ return _extendedBy;
+ }
+
+ public boolean isExtended() {
+ return (_extendedBy.size() > 0);
+ }
+
+ public void addExtendedBy(ClassDescriptor classDesc) {
+ _extendedBy.add(classDesc);
}
public ClassDescriptor getDepends() {
Index: main/org/exolab/castor/persist/ClassMolder.java
===================================================================
RCS file: /scm/castor/castor/src/main/org/exolab/castor/persist/ClassMolder.java,v
retrieving revision 1.24
diff -u -r1.24 ClassMolder.java
--- main/org/exolab/castor/persist/ClassMolder.java 20 Jun 2005 12:00:50 -0000 1.24
+++ main/org/exolab/castor/persist/ClassMolder.java 15 Jul 2005 21:47:34 -0000
@@ -76,6 +76,8 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+
+import org.castor.persist.ProposedObject;
import org.castor.persist.TransactionContext;
import org.exolab.castor.jdo.DuplicateIdentityException;
import org.exolab.castor.jdo.ObjectDeletedException;
@@ -487,17 +489,23 @@
extendFields = getFullFields( extend );
thisFields = clsMap.getFieldMapping();
- fieldList = new ArrayList(extendFields.length + thisFields.length);
+ fieldList = new ArrayList(extendFields.length + thisFields.length - identities.length);
for (int i = 0; i < extendFields.length; i++) {
fieldList.add(extendFields[i]);
}
- for ( int i=0; i
+
+ JDO tests for db2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
JDO tests for Hypersonic SQL
@@ -6,8 +80,8 @@
+ Concurrent updates are not supported and don't throw
+ an exception at hsql 1.7.3.3 and earlier releases -->
@@ -18,7 +92,7 @@
+ Throws ClassCastExceptions at SQLType.convert() -->
@@ -37,12 +111,12 @@
-
-
-
-
+
+
@@ -62,6 +136,7 @@
+
@@ -74,9 +149,11 @@
-
-
-
+
+
+
+
+
@@ -136,6 +213,7 @@
+
@@ -148,6 +226,8 @@
+
+
@@ -209,6 +289,7 @@
+
@@ -219,10 +300,11 @@
-
-
-
-
+
+
+
+
+
@@ -282,8 +364,9 @@
-
+
+
@@ -296,9 +379,11 @@
-
-
-
+
+
+
+
+
@@ -358,6 +443,7 @@
+
@@ -370,6 +456,8 @@
+
+
@@ -431,6 +519,7 @@
+
@@ -443,6 +532,8 @@
+
+
@@ -505,6 +596,7 @@
+
@@ -515,80 +607,13 @@
-
-
-
-
- JDO tests for Oracle8i
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
-
-
-
-
-
-
-
+
+ Table used for concurrency and performance testing
+
+
+
+
+
+
+
+
+
+
+
+
Table used for concurrency and performance testing
@@ -295,7 +310,7 @@
-
+
@@ -307,7 +322,7 @@
Test Persistent interface handling
-
+
Index: tests/jdo/mssql.sql
===================================================================
RCS file: /scm/castor/castor/src/tests/jdo/mssql.sql,v
retrieving revision 1.8
diff -u -r1.8 mssql.sql
--- tests/jdo/mssql.sql 5 Jul 2005 13:25:40 -0000 1.8
+++ tests/jdo/mssql.sql 15 Jul 2005 21:47:56 -0000
@@ -961,3 +961,326 @@
insert into trans_child2 (id, descr, entityOneId) values (3, 'description3', 1)
go
+-- tc9x TESTS
+
+drop table poly_ordr
+go
+create table poly_ordr (
+ id int not null,
+ name varchar (20) not null
+)
+go
+
+drop table poly_detail
+go
+create table poly_detail (
+ id int not null,
+ category varchar (20) not null,
+ location varchar (20) not null
+)
+go
+
+drop table poly_owner
+go
+create table poly_owner (
+ id int not null,
+ name varchar (20) not null,
+ product int not null
+)
+go
+
+drop table poly_prod
+go
+create table poly_prod (
+ id int not null,
+ name varchar(200) not null,
+ detail int not null
+)
+go
+
+drop table poly_computer
+go
+create table poly_computer (
+ id int not null,
+ cpu varchar(200) not null
+)
+go
+
+drop table poly_laptop
+go
+create table poly_laptop (
+ id int not null,
+ weight int not null,
+ resolution varchar(19) not null
+)
+go
+
+drop table poly_server
+go
+create table poly_server (
+ id int not null,
+ numberOfCPUs int not null,
+ support int not null
+)
+go
+
+drop table poly_car
+go
+create table poly_car (
+ id int not null,
+ kw int not null,
+ make varchar(200) not null
+)
+go
+
+drop table poly_truck
+go
+create table poly_truck (
+ id int not null,
+ max_weight int not null
+)
+go
+
+drop table poly_prod_multi
+go
+create table poly_prod_multi (
+ id1 int not null,
+ id2 int not null,
+ name varchar(200) not null,
+ detail int not null
+)
+go
+
+drop table poly_computer_multi
+go
+create table poly_computer_multi (
+ id1 int not null,
+ id2 int not null,
+ cpu varchar(200) not null
+)
+go
+
+drop table poly_laptop_multi
+go
+create table poly_laptop_multi (
+ id1 int not null,
+ id2 int not null,
+ weight int not null,
+ resolution varchar(19) not null
+)
+go
+
+drop table poly_server_multi
+go
+create table poly_server_multi (
+ id1 int not null,
+ id2 int not null,
+ numberOfCPUs int not null,
+ support int not null
+)
+go
+
+drop table poly_order_product
+go
+create table poly_order_product (
+ order_id int not null,
+ product_id int not null
+)
+go
+
+drop table poly_table_m
+go
+create table poly_table_m (
+ id int not null,
+ name varchar(20) not null
+)
+go
+
+drop table poly_table_n
+go
+create table poly_table_n (
+ id int not null,
+ name varchar(20) not null
+)
+go
+
+drop table poly_m_n
+go
+create table poly_m_n (
+ m_id int not null,
+ n_id int not null
+)
+go
+
+
+insert into poly_detail (id, category, location) values (1, 'category 1', 'location 1')
+go
+insert into poly_detail (id, category, location) values (2, 'category 2', 'location 2')
+go
+insert into poly_detail (id, category, location) values (3, 'category 3', 'location 3')
+go
+insert into poly_detail (id, category, location) values (4, 'category 4', 'location 4')
+go
+insert into poly_detail (id, category, location) values (5, 'category 5', 'location 5')
+go
+
+insert into poly_prod (id, name, detail) values (1, 'laptop 1', 1)
+go
+insert into poly_computer (id, cpu) values (1, 'centrino')
+go
+insert into poly_laptop (id, weight, resolution) values (1, 2800, '1280')
+go
+
+insert into poly_prod (id, name, detail) values (2, 'laptop 2', 2)
+go
+insert into poly_computer (id, cpu) values (2, 'centrino')
+go
+insert into poly_laptop (id, weight, resolution) values (2, 2700, '1024')
+go
+
+insert into poly_prod (id, name, detail) values (3, 'server 3', 3)
+go
+insert into poly_computer (id, cpu) values (3, 'pentium 4')
+go
+insert into poly_server (id, numberOfCPUs, support) values (3, 4, 3)
+go
+
+insert into poly_prod (id, name, detail) values (4, 'server 4', 4)
+go
+insert into poly_computer (id, cpu) values (4, 'pentium 4')
+go
+insert into poly_server (id, numberOfCPUs, support) values (4, 16,5)
+go
+
+insert into poly_prod (id, name, detail) values (5, 'truck 5', 5)
+go
+insert into poly_car (id, kw, make) values (5, 60, 'make 5')
+go
+insert into poly_truck (id, max_weight) values (5, 4)
+go
+
+insert into poly_prod_multi (id1, id2, name, detail) values (1, 1, 'laptop 1', 1)
+go
+insert into poly_computer_multi (id1, id2, cpu) values (1, 1, 'centrino')
+go
+insert into poly_laptop_multi (id1, id2, weight, resolution) values (1, 1, 2800, '1280')
+go
+
+insert into poly_prod_multi (id1, id2, name, detail) values (2, 2, 'laptop 2', 2)
+go
+insert into poly_computer_multi (id1, id2, cpu) values (2, 2, 'centrino')
+go
+insert into poly_laptop_multi (id1, id2, weight, resolution) values (2, 2, 2700, '1024')
+go
+
+insert into poly_prod_multi (id1, id2, name, detail) values (3, 3, 'server 3', 3)
+go
+insert into poly_computer_multi (id1, id2, cpu) values (3, 3, 'pentium 4')
+go
+insert into poly_server_multi (id1, id2, numberOfCPUs, support) values (3, 3, 4, 3)
+go
+
+insert into poly_prod_multi (id1, id2, name, detail) values (4, 4, 'server 4', 4)
+go
+insert into poly_computer_multi (id1, id2, cpu) values (4, 4, 'pentium 4')
+go
+insert into poly_server_multi (id1, id2, numberOfCPUs, support) values (4, 4, 16,5)
+go
+
+insert into poly_owner (id, name, product) values (1, 'owner 1', 1)
+go
+
+insert into poly_ordr (id, name) values (1, 'order 1')
+go
+
+insert into poly_order_product (order_id, product_id) values (1, 1)
+go
+insert into poly_order_product (order_id, product_id) values (1, 2)
+go
+
+insert into poly_m_n (m_id, n_id) values (1, 1)
+go
+insert into poly_m_n (m_id, n_id) values (1, 2)
+go
+
+insert into poly_table_m (id, name) values (1, "m1")
+go
+insert into poly_table_m (id, name) values (2, "m2")
+go
+
+insert into poly_table_n (id, name) values (1, "n1")
+go
+insert into poly_table_n (id, name) values (2, "n2")
+go
+
+drop tabel if exists poly_base
+go
+create table poly_base (
+ id varchar(64) not null default '',
+ color varchar(64) default null,
+ primary key (ID)
+)
+go
+
+insert into poly_base values ('100','red')
+go
+
+drop table poly_derived
+go
+create table poly_derived (
+ id varchar(64) not null default '',
+ scent varchar(64) default null,
+ primary key (ID)
+)
+go
+insert into poly_derived values ('100','vanilla')
+go
+
+drop table poly_container
+go
+create table poly_container (
+ id varchar(64) not null default '',
+ reference varchar(64) default null,
+ primary key (ID)
+)
+go
+insert into poly_container values ('200','100')
+go
+
+drop table poly_Product
+go
+create table poly_Product(
+ IdProd numeric(10) primary key,
+ NameProd varchar(30) null,
+ DescProd varchar(30) null
+)
+go
+
+drop table poly_ActProduct
+go
+create table poly_ActProduct(
+ IdAct numeric(10) primary key references Product (IdProd),
+ BestSeason varchar(30) null
+)
+go
+
+drop table poly_ComposedOffer
+go
+create table poly_ComposedOffer(
+ IdCOffer numeric(10) primary key references Product (IdProd),
+ NameCO varchar(30) null,
+ DescCO varchar(30) null
+)
+go
+
+drop table poly_OfferComposition
+go
+create table poly_OfferComposition(
+ Offer numeric(10),
+ Product numeric(10),
+ constraint unique_rel unique (Offer, Product)
+)
+go
+
+
+
Index: tests/jdo/mysql.sql
===================================================================
RCS file: /scm/castor/castor/src/tests/jdo/mysql.sql,v
retrieving revision 1.13
diff -u -r1.13 mysql.sql
--- tests/jdo/mysql.sql 5 Jul 2005 13:25:40 -0000 1.13
+++ tests/jdo/mysql.sql 15 Jul 2005 21:47:57 -0000
@@ -761,3 +761,233 @@
insert into trans_child2 (id, descr, entityOneId) values (2, 'description2', 1);
insert into trans_child2 (id, descr, entityOneId) values (3, 'description3', 1);
+-- tc9x TESTS
+
+drop table if exists poly_ordr;
+create table poly_ordr (
+ id int not null,
+ name varchar (20) not null
+);
+
+drop table if exists poly_detail;
+create table poly_detail (
+ id int not null,
+ category varchar (20) not null,
+ location varchar (20) not null
+);
+
+drop table if exists poly_owner;
+create table poly_owner (
+ id int not null,
+ name varchar (20) not null,
+ product int not null
+);
+
+drop table if exists poly_prod;
+create table poly_prod (
+ id int not null,
+ name varchar(200) not null,
+ detail int not null
+);
+
+drop table if exists poly_computer;
+create table poly_computer (
+ id int not null,
+ cpu varchar(200) not null
+);
+
+drop table if exists poly_laptop;
+create table poly_laptop (
+ id int not null,
+ weight int not null,
+ resolution varchar(19) not null
+);
+
+drop table if exists poly_server;
+create table poly_server (
+ id int not null,
+ numberOfCPUs int not null,
+ support int not null
+);
+
+drop table if exists poly_car;
+create table poly_car (
+ id int not null,
+ kw int not null,
+ make varchar(200) not null
+);
+
+drop table if exists poly_truck;
+create table poly_truck (
+ id int not null,
+ max_weight int not null
+);
+
+drop table if exists poly_prod_multi;
+create table poly_prod_multi (
+ id1 int not null,
+ id2 int not null,
+ name varchar(200) not null,
+ detail int not null
+);
+
+drop table if exists poly_computer_multi;
+create table poly_computer_multi (
+ id1 int not null,
+ id2 int not null,
+ cpu varchar(200) not null
+);
+
+drop table if exists poly_laptop_multi;
+create table poly_laptop_multi (
+ id1 int not null,
+ id2 int not null,
+ weight int not null,
+ resolution varchar(19) not null
+);
+
+drop table if exists poly_server_multi;
+create table poly_server_multi (
+ id1 int not null,
+ id2 int not null,
+ numberOfCPUs int not null,
+ support int not null
+);
+
+drop table if exists poly_order_product;
+create table poly_order_product (
+ order_id int not null,
+ product_id int not null
+);
+
+drop table if exists poly_table_m;
+create table poly_table_m (
+ id int not null,
+ name varchar(20) not null
+);
+
+drop table if exists poly_table_n;
+create table poly_table_n (
+ id int not null,
+ name varchar(20) not null
+);
+
+drop table if exists poly_m_n;
+create table poly_m_n (
+ m_id int not null,
+ n_id int not null
+);
+
+insert into poly_detail (id, category, location) values (1, 'category 1', 'location 1');
+insert into poly_detail (id, category, location) values (2, 'category 2', 'location 2');
+insert into poly_detail (id, category, location) values (3, 'category 3', 'location 3');
+insert into poly_detail (id, category, location) values (4, 'category 4', 'location 4');
+insert into poly_detail (id, category, location) values (5, 'category 5', 'location 5');
+
+insert into poly_prod (id, name, detail) values (1, 'laptop 1', 1);
+insert into poly_computer (id, cpu) values (1, 'centrino');
+insert into poly_laptop (id, weight, resolution) values (1, 2800, '1280');
+
+insert into poly_prod (id, name, detail) values (2, 'laptop 2', 2);
+insert into poly_computer (id, cpu) values (2, 'centrino');
+insert into poly_laptop (id, weight, resolution) values (2, 2700, '1024');
+
+insert into poly_prod (id, name, detail) values (3, 'server 3', 3);
+insert into poly_computer (id, cpu) values (3, 'pentium 4');
+insert into poly_server (id, numberOfCPUs, support) values (3, 4, 3);
+
+insert into poly_prod (id, name, detail) values (4, 'server 4', 4);
+insert into poly_computer (id, cpu) values (4, 'pentium 4');
+insert into poly_server (id, numberOfCPUs, support) values (4, 16,5);
+
+insert into poly_prod (id, name, detail) values (5, 'truck 5', 5);
+insert into poly_car (id, kw, make) values (5, 60, 'make 5');
+insert into poly_truck (id, max_weight) values (5, 4);
+
+insert into poly_prod_multi (id1, id2, name, detail) values (1, 1, 'laptop 1', 1);
+insert into poly_computer_multi (id1, id2, cpu) values (1, 1, 'centrino');
+insert into poly_laptop_multi (id1, id2, weight, resolution) values (1, 1, 2800, '1280');
+
+insert into poly_prod_multi (id1, id2, name, detail) values (2, 2, 'laptop 2', 2);
+insert into poly_computer_multi (id1, id2, cpu) values (2, 2, 'centrino');
+insert into poly_laptop_multi (id1, id2, weight, resolution) values (2, 2, 2700, '1024');
+
+insert into poly_prod_multi (id1, id2, name, detail) values (3, 3, 'server 3', 3);
+insert into poly_computer_multi (id1, id2, cpu) values (3, 3, 'pentium 4');
+insert into poly_server_multi (id1, id2, numberOfCPUs, support) values (3, 3, 4, 3);
+
+insert into poly_prod_multi (id1, id2, name, detail) values (4, 4, 'server 4', 4);
+insert into poly_computer_multi (id1, id2, cpu) values (4, 4, 'pentium 4');
+insert into poly_server_multi (id1, id2, numberOfCPUs, support) values (4, 4, 16,5);
+
+insert into poly_owner (id, name, product) values (1, 'owner 1', 1);
+
+insert into poly_ordr (id, name) values (1, 'order 1');
+
+insert into poly_order_product (order_id, product_id) values (1, 1);
+insert into poly_order_product (order_id, product_id) values (1, 2);
+
+insert into poly_m_n (m_id, n_id) values (1, 1);
+insert into poly_m_n (m_id, n_id) values (1, 2);
+
+insert into poly_table_m (id, name) values (1, "m1");
+insert into poly_table_m (id, name) values (2, "m2");
+
+insert into poly_table_n (id, name) values (1, "n1");
+insert into poly_table_n (id, name) values (2, "n2");
+
+/*
+* Two objects, a Derived and a Container.
+* Since Derived derives from Base there is a row in Base too.
+* The Container id = 200
+* The Derived id = 100
+*/
+DROP TABLE IF EXISTS poly_base;
+CREATE TABLE poly_base (
+ id varchar(64) NOT NULL default '',
+ color varchar(64) default NULL,
+ PRIMARY KEY (ID)
+) ;
+
+INSERT INTO poly_base VALUES ('100','red');
+
+DROP TABLE IF EXISTS poly_derived;
+CREATE TABLE poly_derived (
+ id varchar(64) NOT NULL default '',
+ scent varchar(64) default NULL,
+ PRIMARY KEY (ID)
+) ;
+INSERT INTO poly_derived VALUES ('100','vanilla');
+
+
+DROP TABLE IF EXISTS poly_container;
+CREATE TABLE poly_container (
+ id varchar(64) NOT NULL default '',
+ reference varchar(64) default NULL,
+ PRIMARY KEY (ID)
+) ;
+INSERT INTO poly_container VALUES ('200','100');
+
+DROP TABLE IF EXISTS poly_Product;
+CREATE TABLE poly_Product(
+ IdProd NUMERIC(10) PRIMARY KEY,
+ NameProd VARCHAR(30) NULL,
+ DescProd VARCHAR(30) NULL);
+
+DROP TABLE IF EXISTS poly_ActProduct;
+CREATE TABLE poly_ActProduct(
+ IdAct NUMERIC(10) PRIMARY KEY REFERENCES Product (IdProd),
+ BestSeason VARCHAR(30) NULL);
+
+DROP TABLE IF EXISTS poly_ComposedOffer;
+CREATE TABLE poly_ComposedOffer(
+ IdCOffer NUMERIC(10) PRIMARY KEY REFERENCES Product (IdProd),
+ NameCO VARCHAR(30) NULL,
+ DescCO VARCHAR(30) NULL);
+
+DROP TABLE IF EXISTS poly_OfferComposition;
+CREATE TABLE poly_OfferComposition(
+ Offer NUMERIC(10),
+ Product NUMERIC(10),
+ CONSTRAINT unique_rel UNIQUE (Offer, Product) );
+
Index: tests/jdo/oracle.sql
===================================================================
RCS file: /scm/castor/castor/src/tests/jdo/oracle.sql,v
retrieving revision 1.10
diff -u -r1.10 oracle.sql
--- tests/jdo/oracle.sql 5 Jul 2005 13:25:40 -0000 1.10
+++ tests/jdo/oracle.sql 15 Jul 2005 21:47:59 -0000
@@ -962,4 +962,230 @@
insert into trans_child2 (id, descr, entityOneId) values (2, 'description2', 1);
insert into trans_child2 (id, descr, entityOneId) values (3, 'description3', 1);
+-- tc9x TESTS
+
+drop table poly_ordr;
+create table poly_ordr (
+ id int not null,
+ name varchar (20) not null
+);
+
+drop table poly_detail;
+create table poly_detail (
+ id int not null,
+ category varchar (20) not null,
+ location varchar (20) not null
+);
+
+drop table poly_owner;
+create table poly_owner (
+ id int not null,
+ name varchar (20) not null,
+ product int not null
+);
+
+drop table poly_prod;
+create table poly_prod (
+ id int not null,
+ name varchar(200) not null,
+ detail int not null
+);
+
+drop table poly_computer;
+create table poly_computer (
+ id int not null,
+ cpu varchar(200) not null
+);
+
+drop table poly_laptop;
+create table poly_laptop (
+ id int not null,
+ weight int not null,
+ resolution varchar(19) not null
+);
+
+drop table poly_server;
+create table poly_server (
+ id int not null,
+ numberOfCPUs int not null,
+ support int not null
+);
+
+drop table poly_car;
+create table poly_car (
+ id int not null,
+ kw int not null,
+ make varchar(200) not null
+);
+
+drop table poly_truck;
+create table poly_truck (
+ id int not null,
+ max_weight int not null
+);
+
+drop table poly_prod_multi;
+create table poly_prod_multi (
+ id1 int not null,
+ id2 int not null,
+ name varchar(200) not null,
+ detail int not null
+);
+
+drop table poly_computer_multi;
+create table poly_computer_multi (
+ id1 int not null,
+ id2 int not null,
+ cpu varchar(200) not null
+);
+
+drop table poly_laptop_multi;
+create table poly_laptop_multi (
+ id1 int not null,
+ id2 int not null,
+ weight int not null,
+ resolution varchar(19) not null
+);
+
+drop table poly_server_multi;
+create table poly_server_multi (
+ id1 int not null,
+ id2 int not null,
+ numberOfCPUs int not null,
+ support int not null
+);
+
+drop table poly_order_product;
+create table poly_order_product (
+ order_id int not null,
+ product_id int not null
+);
+
+drop table poly_table_m;
+create table poly_table_m (
+ id int not null,
+ name varchar(20) not null
+);
+
+drop table poly_table_n;
+create table poly_table_n (
+ id int not null,
+ name varchar(20) not null
+);
+
+drop table poly_m_n;
+create table poly_m_n (
+ m_id int not null,
+ n_id int not null
+);
+
+
+insert into poly_detail (id, category, location) values (1, 'category 1', 'location 1');
+insert into poly_detail (id, category, location) values (2, 'category 2', 'location 2');
+insert into poly_detail (id, category, location) values (3, 'category 3', 'location 3');
+insert into poly_detail (id, category, location) values (4, 'category 4', 'location 4');
+insert into poly_detail (id, category, location) values (5, 'category 5', 'location 5');
+
+insert into poly_prod (id, name, detail) values (1, 'laptop 1', 1);
+insert into poly_computer (id, cpu) values (1, 'centrino');
+insert into poly_laptop (id, weight, resolution) values (1, 2800, '1280');
+
+insert into poly_prod (id, name, detail) values (2, 'laptop 2', 2);
+insert into poly_computer (id, cpu) values (2, 'centrino');
+insert into poly_laptop (id, weight, resolution) values (2, 2700, '1024');
+
+insert into poly_prod (id, name, detail) values (3, 'server 3', 3);
+insert into poly_computer (id, cpu) values (3, 'pentium 4');
+insert into poly_server (id, numberOfCPUs, support) values (3, 4, 3);
+
+insert into poly_prod (id, name, detail) values (4, 'server 4', 4);
+insert into poly_computer (id, cpu) values (4, 'pentium 4');
+insert into poly_server (id, numberOfCPUs, support) values (4, 16,5);
+
+insert into poly_prod (id, name, detail) values (5, 'truck 5', 5);
+insert into poly_car (id, kw, make) values (5, 60, 'make 5');
+insert into poly_truck (id, max_weight) values (5, 4);
+
+insert into poly_prod_multi (id1, id2, name, detail) values (1, 1, 'laptop 1', 1);
+insert into poly_computer_multi (id1, id2, cpu) values (1, 1, 'centrino');
+insert into poly_laptop_multi (id1, id2, weight, resolution) values (1, 1, 2800, '1280');
+
+insert into poly_prod_multi (id1, id2, name, detail) values (2, 2, 'laptop 2', 2);
+insert into poly_computer_multi (id1, id2, cpu) values (2, 2, 'centrino');
+insert into poly_laptop_multi (id1, id2, weight, resolution) values (2, 2, 2700, '1024');
+
+insert into poly_prod_multi (id1, id2, name, detail) values (3, 3, 'server 3', 3);
+insert into poly_computer_multi (id1, id2, cpu) values (3, 3, 'pentium 4');
+insert into poly_server_multi (id1, id2, numberOfCPUs, support) values (3, 3, 4, 3);
+
+insert into poly_prod_multi (id1, id2, name, detail) values (4, 4, 'server 4', 4);
+insert into poly_computer_multi (id1, id2, cpu) values (4, 4, 'pentium 4');
+insert into poly_server_multi (id1, id2, numberOfCPUs, support) values (4, 4, 16,5);
+
+insert into poly_owner (id, name, product) values (1, 'owner 1', 1);
+
+insert into poly_ordr (id, name) values (1, 'order 1');
+
+insert into poly_order_product (order_id, product_id) values (1, 1);
+insert into poly_order_product (order_id, product_id) values (1, 2);
+
+insert into poly_m_n (m_id, n_id) values (1, 1);
+insert into poly_m_n (m_id, n_id) values (1, 2);
+
+insert into poly_table_m (id, name) values (1, 'm1');
+insert into poly_table_m (id, name) values (2, 'm2');
+
+insert into poly_table_n (id, name) values (1, 'n1');
+insert into poly_table_n (id, name) values (2, 'n2');
+
+drop table poly_base;
+create table poly_base (
+ id varchar(64) not null,
+ color varchar(64) default null,
+ primary key (ID)
+) ;
+
+insert into poly_base values ('100','red');
+
+drop table poly_derived;
+create table poly_derived (
+ id varchar(64) not null,
+ scent varchar(64) default null,
+ primary key (ID)
+) ;
+insert into poly_derived values ('100','vanilla');
+
+
+drop table poly_container;
+create table poly_container (
+ id varchar(64) not null,
+ reference varchar(64) default null,
+ primary key (ID)
+) ;
+insert into poly_container values ('200','100');
+
+drop table poly_Product;
+create table poly_Product(
+ IdProd numeric(10) primary key,
+ NameProd varchar(30) null,
+ DescProd varchar(30) null);
+
+drop table poly_ActProduct;
+create table poly_ActProduct(
+ IdAct numeric(10) primary key,
+ BestSeason varchar(30) null);
+
+drop table poly_ComposedOffer;
+create table poly_ComposedOffer(
+ IdCOffer numeric(10) primary key,
+ NameCO varchar(30) null,
+ DescCO varchar(30) null);
+
+drop table poly_OfferComposition;
+create table poly_OfferComposition(
+ Offer numeric(10),
+ Product numeric(10),
+ constraint unique_rel unique (Offer, Product) );
+
+
Index: tests/jdo/postgres.sql
===================================================================
RCS file: /scm/castor/castor/src/tests/jdo/postgres.sql,v
retrieving revision 1.4
diff -u -r1.4 postgres.sql
--- tests/jdo/postgres.sql 5 Jul 2005 13:25:40 -0000 1.4
+++ tests/jdo/postgres.sql 15 Jul 2005 21:48:02 -0000
@@ -747,4 +747,235 @@
insert into trans_child2 (id, descr, entityOneId) values (2, 'description2', 1);
insert into trans_child2 (id, descr, entityOneId) values (3, 'description3', 1);
+-- tc9x TESTS
+
+drop table poly_ordr;
+create table poly_ordr (
+ id int not null,
+ name varchar (20) not null
+);
+
+drop table poly_detail;
+create table poly_detail (
+ id int not null,
+ category varchar (20) not null,
+ location varchar (20) not null
+);
+
+drop table poly_owner;
+create table poly_owner (
+ id int not null,
+ name varchar (20) not null,
+ product int not null
+);
+
+drop table poly_prod;
+create table poly_prod (
+ id int not null,
+ name varchar(200) not null,
+ detail int not null
+);
+
+drop table poly_computer;
+create table poly_computer (
+ id int not null,
+ cpu varchar(200) not null
+);
+
+drop table poly_laptop;
+create table poly_laptop (
+ id int not null,
+ weight int not null,
+ resolution varchar(19) not null
+);
+
+drop table poly_server;
+create table poly_server (
+ id int not null,
+ numberOfCPUs int not null,
+ support int not null
+);
+
+drop table poly_car;
+create table poly_car (
+ id int not null,
+ kw int not null,
+ make varchar(200) not null
+);
+
+drop table poly_truck;
+create table poly_truck (
+ id int not null,
+ max_weight int not null
+);
+
+drop table poly_prod_multi;
+create table poly_prod_multi (
+ id1 int not null,
+ id2 int not null,
+ name varchar(200) not null,
+ detail int not null
+);
+
+drop table poly_computer_multi;
+create table poly_computer_multi (
+ id1 int not null,
+ id2 int not null,
+ cpu varchar(200) not null
+);
+
+drop table poly_laptop_multi;
+create table poly_laptop_multi (
+ id1 int not null,
+ id2 int not null,
+ weight int not null,
+ resolution varchar(19) not null
+);
+
+drop table poly_server_multi;
+create table poly_server_multi (
+ id1 int not null,
+ id2 int not null,
+ numberOfCPUs int not null,
+ support int not null
+);
+
+drop table poly_order_product;
+create table poly_order_product (
+ order_id int not null,
+ product_id int not null
+);
+
+drop table poly_table_m;
+create table poly_table_m (
+ id int not null,
+ name varchar(20) not null
+);
+
+drop table poly_table_n;
+create table poly_table_n (
+ id int not null,
+ name varchar(20) not null
+);
+
+drop table poly_m_n;
+create table poly_m_n (
+ m_id int not null,
+ n_id int not null
+);
+
+
+insert into poly_detail (id, category, location) values (1, 'category 1', 'location 1');
+insert into poly_detail (id, category, location) values (2, 'category 2', 'location 2');
+insert into poly_detail (id, category, location) values (3, 'category 3', 'location 3');
+insert into poly_detail (id, category, location) values (4, 'category 4', 'location 4');
+insert into poly_detail (id, category, location) values (5, 'category 5', 'location 5');
+
+insert into poly_prod (id, name, detail) values (1, 'laptop 1', 1);
+insert into poly_computer (id, cpu) values (1, 'centrino');
+insert into poly_laptop (id, weight, resolution) values (1, 2800, '1280');
+
+insert into poly_prod (id, name, detail) values (2, 'laptop 2', 2);
+insert into poly_computer (id, cpu) values (2, 'centrino');
+insert into poly_laptop (id, weight, resolution) values (2, 2700, '1024');
+
+insert into poly_prod (id, name, detail) values (3, 'server 3', 3);
+insert into poly_computer (id, cpu) values (3, 'pentium 4');
+insert into poly_server (id, numberOfCPUs, support) values (3, 4, 3);
+
+insert into poly_prod (id, name, detail) values (4, 'server 4', 4);
+insert into poly_computer (id, cpu) values (4, 'pentium 4');
+insert into poly_server (id, numberOfCPUs, support) values (4, 16,5);
+
+insert into poly_prod (id, name, detail) values (5, 'truck 5', 5);
+insert into poly_car (id, kw, make) values (5, 60, 'make 5');
+insert into poly_truck (id, max_weight) values (5, 4);
+
+insert into poly_prod_multi (id1, id2, name, detail) values (1, 1, 'laptop 1', 1);
+insert into poly_computer_multi (id1, id2, cpu) values (1, 1, 'centrino');
+insert into poly_laptop_multi (id1, id2, weight, resolution) values (1, 1, 2800, '1280');
+
+insert into poly_prod_multi (id1, id2, name, detail) values (2, 2, 'laptop 2', 2);
+insert into poly_computer_multi (id1, id2, cpu) values (2, 2, 'centrino');
+insert into poly_laptop_multi (id1, id2, weight, resolution) values (2, 2, 2700, '1024');
+
+insert into poly_prod_multi (id1, id2, name, detail) values (3, 3, 'server 3', 3);
+insert into poly_computer_multi (id1, id2, cpu) values (3, 3, 'pentium 4');
+insert into poly_server_multi (id1, id2, numberOfCPUs, support) values (3, 3, 4, 3);
+
+insert into poly_prod_multi (id1, id2, name, detail) values (4, 4, 'server 4', 4);
+insert into poly_computer_multi (id1, id2, cpu) values (4, 4, 'pentium 4');
+insert into poly_server_multi (id1, id2, numberOfCPUs, support) values (4, 4, 16,5);
+
+insert into poly_owner (id, name, product) values (1, 'owner 1', 1);
+
+insert into poly_ordr (id, name) values (1, 'order 1');
+
+insert into poly_order_product (order_id, product_id) values (1, 1);
+insert into poly_order_product (order_id, product_id) values (1, 2);
+
+insert into poly_m_n (m_id, n_id) values (1, 1);
+insert into poly_m_n (m_id, n_id) values (1, 2);
+
+insert into poly_table_m (id, name) values (1, "m1");
+insert into poly_table_m (id, name) values (2, "m2");
+
+insert into poly_table_n (id, name) values (1, "n1");
+insert into poly_table_n (id, name) values (2, "n2");
+
+drop tabel if exists poly_base;
+create table poly_base (
+ id varchar(64) not null default '',
+ color varchar(64) default null,
+ primary key (ID)
+) ;
+
+insert into poly_base values ('100','red');
+
+drop table poly_derived;
+create table poly_derived (
+ id varchar(64) not null default '',
+ scent varchar(64) default null,
+ primary key (ID)
+);
+insert into poly_derived values ('100','vanilla');
+
+
+drop table poly_container;
+create table poly_container (
+ id varchar(64) not null default '',
+ reference varchar(64) default null,
+ primary key (ID)
+);
+insert into poly_container values ('200','100');
+
+drop table poly_Product;
+create table poly_Product(
+ IdProd numeric(10) primary key,
+ NameProd varchar(30) null,
+ DescProd varchar(30) null
+);
+
+drop table poly_ActProduct;
+create table poly_ActProduct(
+ IdAct numeric(10) primary key references Product (IdProd),
+ BestSeason varchar(30) null
+);
+
+drop table poly_ComposedOffer;
+create table poly_ComposedOffer(
+ IdCOffer numeric(10) primary key references Product (IdProd),
+ NameCO varchar(30) null,
+ DescCO varchar(30) null
+);
+
+drop table poly_OfferComposition;
+create table poly_OfferComposition(
+ Offer numeric(10),
+ Product numeric(10),
+ constraint unique_rel unique (Offer, Product)
+);
+
+
+
Index: tests/jdo/sapdb.sql
===================================================================
RCS file: /scm/castor/castor/src/tests/jdo/sapdb.sql,v
retrieving revision 1.10
diff -u -r1.10 sapdb.sql
--- tests/jdo/sapdb.sql 5 Jul 2005 13:25:40 -0000 1.10
+++ tests/jdo/sapdb.sql 15 Jul 2005 21:48:05 -0000
@@ -910,3 +910,326 @@
insert into trans_child2 (id, descr, entityOneId) values (2, 'description2', 1) //
insert into trans_child2 (id, descr, entityOneId) values (3, 'description3', 1) //
+-- tc9x TESTS
+
+drop table poly_ordr
+//
+create table poly_ordr (
+ id int not null,
+ name varchar (20) not null
+)
+//
+
+drop table poly_detail
+//
+create table poly_detail (
+ id int not null,
+ category varchar (20) not null,
+ location varchar (20) not null
+)
+//
+
+drop table poly_owner
+//
+create table poly_owner (
+ id int not null,
+ name varchar (20) not null,
+ product int not null
+)
+//
+
+drop table poly_prod
+//
+create table poly_prod (
+ id int not null,
+ name varchar(200) not null,
+ detail int not null
+)
+//
+
+drop table poly_computer
+//
+create table poly_computer (
+ id int not null,
+ cpu varchar(200) not null
+)
+//
+
+drop table poly_laptop
+//
+create table poly_laptop (
+ id int not null,
+ weight int not null,
+ resolution varchar(19) not null
+)
+//
+
+drop table poly_server
+//
+create table poly_server (
+ id int not null,
+ numberOfCPUs int not null,
+ support int not null
+)
+//
+
+drop table poly_car
+//
+create table poly_car (
+ id int not null,
+ kw int not null,
+ make varchar(200) not null
+)
+//
+
+drop table poly_truck
+//
+create table poly_truck (
+ id int not null,
+ max_weight int not null
+)
+//
+
+drop table poly_prod_multi
+//
+create table poly_prod_multi (
+ id1 int not null,
+ id2 int not null,
+ name varchar(200) not null,
+ detail int not null
+)
+//
+
+drop table poly_computer_multi
+//
+create table poly_computer_multi (
+ id1 int not null,
+ id2 int not null,
+ cpu varchar(200) not null
+)
+//
+
+drop table poly_laptop_multi
+//
+create table poly_laptop_multi (
+ id1 int not null,
+ id2 int not null,
+ weight int not null,
+ resolution varchar(19) not null
+)
+//
+
+drop table poly_server_multi
+//
+create table poly_server_multi (
+ id1 int not null,
+ id2 int not null,
+ numberOfCPUs int not null,
+ support int not null
+)
+//
+
+drop table poly_order_product
+//
+create table poly_order_product (
+ order_id int not null,
+ product_id int not null
+)
+//
+
+drop table poly_table_m
+//
+create table poly_table_m (
+ id int not null,
+ name varchar(20) not null
+)
+//
+
+drop table poly_table_n
+//
+create table poly_table_n (
+ id int not null,
+ name varchar(20) not null
+)
+//
+
+drop table poly_m_n
+//
+create table poly_m_n (
+ m_id int not null,
+ n_id int not null
+)
+//
+
+
+insert into poly_detail (id, category, location) values (1, 'category 1', 'location 1')
+//
+insert into poly_detail (id, category, location) values (2, 'category 2', 'location 2')
+//
+insert into poly_detail (id, category, location) values (3, 'category 3', 'location 3')
+//
+insert into poly_detail (id, category, location) values (4, 'category 4', 'location 4')
+//
+insert into poly_detail (id, category, location) values (5, 'category 5', 'location 5')
+//
+
+insert into poly_prod (id, name, detail) values (1, 'laptop 1', 1)
+//
+insert into poly_computer (id, cpu) values (1, 'centrino')
+//
+insert into poly_laptop (id, weight, resolution) values (1, 2800, '1280')
+//
+
+insert into poly_prod (id, name, detail) values (2, 'laptop 2', 2)
+//
+insert into poly_computer (id, cpu) values (2, 'centrino')
+//
+insert into poly_laptop (id, weight, resolution) values (2, 2700, '1024')
+//
+
+insert into poly_prod (id, name, detail) values (3, 'server 3', 3)
+//
+insert into poly_computer (id, cpu) values (3, 'pentium 4')
+//
+insert into poly_server (id, numberOfCPUs, support) values (3, 4, 3)
+//
+
+insert into poly_prod (id, name, detail) values (4, 'server 4', 4)
+//
+insert into poly_computer (id, cpu) values (4, 'pentium 4')
+//
+insert into poly_server (id, numberOfCPUs, support) values (4, 16,5)
+//
+
+insert into poly_prod (id, name, detail) values (5, 'truck 5', 5)
+//
+insert into poly_car (id, kw, make) values (5, 60, 'make 5')
+//
+insert into poly_truck (id, max_weight) values (5, 4)
+//
+
+insert into poly_prod_multi (id1, id2, name, detail) values (1, 1, 'laptop 1', 1)
+//
+insert into poly_computer_multi (id1, id2, cpu) values (1, 1, 'centrino')
+//
+insert into poly_laptop_multi (id1, id2, weight, resolution) values (1, 1, 2800, '1280')
+//
+
+insert into poly_prod_multi (id1, id2, name, detail) values (2, 2, 'laptop 2', 2)
+//
+insert into poly_computer_multi (id1, id2, cpu) values (2, 2, 'centrino')
+//
+insert into poly_laptop_multi (id1, id2, weight, resolution) values (2, 2, 2700, '1024')
+//
+
+insert into poly_prod_multi (id1, id2, name, detail) values (3, 3, 'server 3', 3)
+//
+insert into poly_computer_multi (id1, id2, cpu) values (3, 3, 'pentium 4')
+//
+insert into poly_server_multi (id1, id2, numberOfCPUs, support) values (3, 3, 4, 3)
+//
+
+insert into poly_prod_multi (id1, id2, name, detail) values (4, 4, 'server 4', 4)
+//
+insert into poly_computer_multi (id1, id2, cpu) values (4, 4, 'pentium 4')
+//
+insert into poly_server_multi (id1, id2, numberOfCPUs, support) values (4, 4, 16,5)
+//
+
+insert into poly_owner (id, name, product) values (1, 'owner 1', 1)
+//
+
+insert into poly_ordr (id, name) values (1, 'order 1')
+//
+
+insert into poly_order_product (order_id, product_id) values (1, 1)
+//
+insert into poly_order_product (order_id, product_id) values (1, 2)
+//
+
+insert into poly_m_n (m_id, n_id) values (1, 1)
+//
+insert into poly_m_n (m_id, n_id) values (1, 2)
+//
+
+insert into poly_table_m (id, name) values (1, "m1")
+//
+insert into poly_table_m (id, name) values (2, "m2")
+//
+
+insert into poly_table_n (id, name) values (1, "n1")
+//
+insert into poly_table_n (id, name) values (2, "n2")
+//
+
+drop tabel if exists poly_base
+//
+create table poly_base (
+ id varchar(64) not null default '',
+ color varchar(64) default null,
+ primary key (ID)
+)
+//
+
+insert into poly_base values ('100','red')
+//
+
+drop table poly_derived
+//
+create table poly_derived (
+ id varchar(64) not null default '',
+ scent varchar(64) default null,
+ primary key (ID)
+)
+//
+insert into poly_derived values ('100','vanilla')
+//
+
+drop table poly_container
+//
+create table poly_container (
+ id varchar(64) not null default '',
+ reference varchar(64) default null,
+ primary key (ID)
+)
+//
+insert into poly_container values ('200','100')
+//
+
+drop table poly_Product
+//
+create table poly_Product(
+ IdProd numeric(10) primary key,
+ NameProd varchar(30) null,
+ DescProd varchar(30) null
+)
+//
+
+drop table poly_ActProduct
+//
+create table poly_ActProduct(
+ IdAct numeric(10) primary key references Product (IdProd),
+ BestSeason varchar(30) null
+)
+//
+
+drop table poly_ComposedOffer
+//
+create table poly_ComposedOffer(
+ IdCOffer numeric(10) primary key references Product (IdProd),
+ NameCO varchar(30) null,
+ DescCO varchar(30) null
+)
+//
+
+drop table poly_OfferComposition
+//
+create table poly_OfferComposition(
+ Offer numeric(10),
+ Product numeric(10),
+ constraint unique_rel unique (Offer, Product)
+)
+//
+
+
+
Index: tests/jdo/sybase.sql
===================================================================
RCS file: /scm/castor/castor/src/tests/jdo/sybase.sql,v
retrieving revision 1.8
diff -u -r1.8 sybase.sql
--- tests/jdo/sybase.sql 5 Jul 2005 13:25:40 -0000 1.8
+++ tests/jdo/sybase.sql 15 Jul 2005 21:48:07 -0000
@@ -922,3 +922,326 @@
insert into trans_child2 (id, descr, entityOneId) values (3, 'description3', 1)
go
+-- tc9x TESTS
+
+drop table poly_ordr
+go
+create table poly_ordr (
+ id int not null,
+ name varchar (20) not null
+)
+go
+
+drop table poly_detail
+go
+create table poly_detail (
+ id int not null,
+ category varchar (20) not null,
+ location varchar (20) not null
+)
+go
+
+drop table poly_owner
+go
+create table poly_owner (
+ id int not null,
+ name varchar (20) not null,
+ product int not null
+)
+go
+
+drop table poly_prod
+go
+create table poly_prod (
+ id int not null,
+ name varchar(200) not null,
+ detail int not null
+)
+go
+
+drop table poly_computer
+go
+create table poly_computer (
+ id int not null,
+ cpu varchar(200) not null
+)
+go
+
+drop table poly_laptop
+go
+create table poly_laptop (
+ id int not null,
+ weight int not null,
+ resolution varchar(19) not null
+)
+go
+
+drop table poly_server
+go
+create table poly_server (
+ id int not null,
+ numberOfCPUs int not null,
+ support int not null
+)
+go
+
+drop table poly_car
+go
+create table poly_car (
+ id int not null,
+ kw int not null,
+ make varchar(200) not null
+)
+go
+
+drop table poly_truck
+go
+create table poly_truck (
+ id int not null,
+ max_weight int not null
+)
+go
+
+drop table poly_prod_multi
+go
+create table poly_prod_multi (
+ id1 int not null,
+ id2 int not null,
+ name varchar(200) not null,
+ detail int not null
+)
+go
+
+drop table poly_computer_multi
+go
+create table poly_computer_multi (
+ id1 int not null,
+ id2 int not null,
+ cpu varchar(200) not null
+)
+go
+
+drop table poly_laptop_multi
+go
+create table poly_laptop_multi (
+ id1 int not null,
+ id2 int not null,
+ weight int not null,
+ resolution varchar(19) not null
+)
+go
+
+drop table poly_server_multi
+go
+create table poly_server_multi (
+ id1 int not null,
+ id2 int not null,
+ numberOfCPUs int not null,
+ support int not null
+)
+go
+
+drop table poly_order_product
+go
+create table poly_order_product (
+ order_id int not null,
+ product_id int not null
+)
+go
+
+drop table poly_table_m
+go
+create table poly_table_m (
+ id int not null,
+ name varchar(20) not null
+)
+go
+
+drop table poly_table_n
+go
+create table poly_table_n (
+ id int not null,
+ name varchar(20) not null
+)
+go
+
+drop table poly_m_n
+go
+create table poly_m_n (
+ m_id int not null,
+ n_id int not null
+)
+go
+
+
+insert into poly_detail (id, category, location) values (1, 'category 1', 'location 1')
+go
+insert into poly_detail (id, category, location) values (2, 'category 2', 'location 2')
+go
+insert into poly_detail (id, category, location) values (3, 'category 3', 'location 3')
+go
+insert into poly_detail (id, category, location) values (4, 'category 4', 'location 4')
+go
+insert into poly_detail (id, category, location) values (5, 'category 5', 'location 5')
+go
+
+insert into poly_prod (id, name, detail) values (1, 'laptop 1', 1)
+go
+insert into poly_computer (id, cpu) values (1, 'centrino')
+go
+insert into poly_laptop (id, weight, resolution) values (1, 2800, '1280')
+go
+
+insert into poly_prod (id, name, detail) values (2, 'laptop 2', 2)
+go
+insert into poly_computer (id, cpu) values (2, 'centrino')
+go
+insert into poly_laptop (id, weight, resolution) values (2, 2700, '1024')
+go
+
+insert into poly_prod (id, name, detail) values (3, 'server 3', 3)
+go
+insert into poly_computer (id, cpu) values (3, 'pentium 4')
+go
+insert into poly_server (id, numberOfCPUs, support) values (3, 4, 3)
+go
+
+insert into poly_prod (id, name, detail) values (4, 'server 4', 4)
+go
+insert into poly_computer (id, cpu) values (4, 'pentium 4')
+go
+insert into poly_server (id, numberOfCPUs, support) values (4, 16,5)
+go
+
+insert into poly_prod (id, name, detail) values (5, 'truck 5', 5)
+go
+insert into poly_car (id, kw, make) values (5, 60, 'make 5')
+go
+insert into poly_truck (id, max_weight) values (5, 4)
+go
+
+insert into poly_prod_multi (id1, id2, name, detail) values (1, 1, 'laptop 1', 1)
+go
+insert into poly_computer_multi (id1, id2, cpu) values (1, 1, 'centrino')
+go
+insert into poly_laptop_multi (id1, id2, weight, resolution) values (1, 1, 2800, '1280')
+go
+
+insert into poly_prod_multi (id1, id2, name, detail) values (2, 2, 'laptop 2', 2)
+go
+insert into poly_computer_multi (id1, id2, cpu) values (2, 2, 'centrino')
+go
+insert into poly_laptop_multi (id1, id2, weight, resolution) values (2, 2, 2700, '1024')
+go
+
+insert into poly_prod_multi (id1, id2, name, detail) values (3, 3, 'server 3', 3)
+go
+insert into poly_computer_multi (id1, id2, cpu) values (3, 3, 'pentium 4')
+go
+insert into poly_server_multi (id1, id2, numberOfCPUs, support) values (3, 3, 4, 3)
+go
+
+insert into poly_prod_multi (id1, id2, name, detail) values (4, 4, 'server 4', 4)
+go
+insert into poly_computer_multi (id1, id2, cpu) values (4, 4, 'pentium 4')
+go
+insert into poly_server_multi (id1, id2, numberOfCPUs, support) values (4, 4, 16,5)
+go
+
+insert into poly_owner (id, name, product) values (1, 'owner 1', 1)
+go
+
+insert into poly_ordr (id, name) values (1, 'order 1')
+go
+
+insert into poly_order_product (order_id, product_id) values (1, 1)
+go
+insert into poly_order_product (order_id, product_id) values (1, 2)
+go
+
+insert into poly_m_n (m_id, n_id) values (1, 1)
+go
+insert into poly_m_n (m_id, n_id) values (1, 2)
+go
+
+insert into poly_table_m (id, name) values (1, "m1")
+go
+insert into poly_table_m (id, name) values (2, "m2")
+go
+
+insert into poly_table_n (id, name) values (1, "n1")
+go
+insert into poly_table_n (id, name) values (2, "n2")
+go
+
+drop tabel if exists poly_base
+go
+create table poly_base (
+ id varchar(64) not null default '',
+ color varchar(64) default null,
+ primary key (ID)
+)
+go
+
+insert into poly_base values ('100','red')
+go
+
+drop table poly_derived
+go
+create table poly_derived (
+ id varchar(64) not null default '',
+ scent varchar(64) default null,
+ primary key (ID)
+)
+go
+insert into poly_derived values ('100','vanilla')
+go
+
+drop table poly_container
+go
+create table poly_container (
+ id varchar(64) not null default '',
+ reference varchar(64) default null,
+ primary key (ID)
+)
+go
+insert into poly_container values ('200','100')
+go
+
+drop table poly_Product
+go
+create table poly_Product(
+ IdProd numeric(10) primary key,
+ NameProd varchar(30) null,
+ DescProd varchar(30) null
+)
+go
+
+drop table poly_ActProduct
+go
+create table poly_ActProduct(
+ IdAct numeric(10) primary key references Product (IdProd),
+ BestSeason varchar(30) null
+)
+go
+
+drop table poly_ComposedOffer
+go
+create table poly_ComposedOffer(
+ IdCOffer numeric(10) primary key references Product (IdProd),
+ NameCO varchar(30) null,
+ DescCO varchar(30) null
+)
+go
+
+drop table poly_OfferComposition
+go
+create table poly_OfferComposition(
+ Offer numeric(10),
+ Product numeric(10),
+ constraint unique_rel unique (Offer, Product)
+)
+go
+
+
+
Index: tests/org/exolab/castor/jdo/drivers/TestConnectionProxies.java
===================================================================
RCS file: /scm/castor/castor/src/tests/org/exolab/castor/jdo/drivers/TestConnectionProxies.java,v
retrieving revision 1.1
diff -u -r1.1 TestConnectionProxies.java
--- tests/org/exolab/castor/jdo/drivers/TestConnectionProxies.java 3 May 2005 15:26:47 -0000 1.1
+++ tests/org/exolab/castor/jdo/drivers/TestConnectionProxies.java 15 Jul 2005 21:48:08 -0000
@@ -11,6 +11,7 @@
import org.exolab.castor.jdo.drivers.ConnectionProxy;
import junit.framework.TestCase;
+import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
@@ -31,7 +32,7 @@
private static final Log log = LogFactory.getLog (TestConnectionProxies.class);
- private ConnectionProxy connectionProxy = null;
+ private Connection connectionProxy = null;
/* (non-Javadoc)
* @see junit.framework.TestCase#setUp()
Index: tests/ptf/jdo/TestAll.java
===================================================================
RCS file: /scm/castor/castor/src/tests/ptf/jdo/TestAll.java,v
retrieving revision 1.3
diff -u -r1.3 TestAll.java
--- tests/ptf/jdo/TestAll.java 25 Jun 2005 01:41:08 -0000 1.3
+++ tests/ptf/jdo/TestAll.java 15 Jul 2005 21:48:08 -0000
@@ -34,5 +34,5 @@
return suite;
}
- public TestAll(String name) { super(name); }
+ public TestAll(final String name) { super(name); }
}
Index: main/org/castor/engine/CounterRef.java
===================================================================
RCS file: main/org/castor/engine/CounterRef.java
diff -N main/org/castor/engine/CounterRef.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ main/org/castor/engine/CounterRef.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2005 Werner Guttmann
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Id: TransactionContext.java,v 1.1 2005/06/20 12:00:59 wguttmn Exp $
+ *
+ */
+package org.castor.engine;
+
+/**
+ * Holds information about table names and counters.
+ *
+ * @author Werner Guttmann
+ */
+public class CounterRef {
+ private int _counter;
+
+ private String _tableName;
+
+ public String getTableName() {
+ return _tableName;
+ }
+ public void setTableName(final String tableName) {
+ _tableName = tableName;
+ }
+ public int getCounter() {
+ return _counter;
+ }
+ public void setCounter(final int counter) {
+ _counter = counter;
+ }
+}
Index: main/org/castor/persist/ProposedObject.java
===================================================================
RCS file: main/org/castor/persist/ProposedObject.java
diff -N main/org/castor/persist/ProposedObject.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ main/org/castor/persist/ProposedObject.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,173 @@
+/*
+ * Copyright 2005 Werner Guttmann
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Id: TransactionContext.java,v 1.1 2005/06/20 12:00:59 wguttmn Exp $
+ *
+ */
+package org.castor.persist;
+
+import org.exolab.castor.persist.ClassMolder;
+
+/**
+ * Holding structure for information about the class instance being loaded by internal
+ * classes, revealing what class was suggested, what class actually got loaded, etc.
+ *
+ * @author Werner Guttmann
+ */
+public class ProposedObject {
+ private Class _proposedClass = null;
+
+ private Class _actualClass = null;
+
+ private Object _object = null;
+
+ private Object[] _fields = null;
+
+ private boolean _isExpanded = false;
+
+ private ClassMolder _actualClassMolder = null;
+
+ /**
+ * Creates a default instance.
+ */
+ public ProposedObject() { }
+
+ /**
+ * Returns the fields of the object in question.
+ *
+ * @return Returns the fields.
+ */
+ public Object[] getFields() {
+ return _fields;
+ }
+
+ /**
+ * Sets the fields of the object in question.
+ *
+ * @param fields The fields to set.
+ */
+ public void setFields(final Object[] fields) {
+ _fields = fields;
+ }
+
+ /**
+ * Returns teh object.
+ *
+ * @return Returns the object.
+ */
+ public Object getObject() {
+ return _object;
+ }
+
+ /**
+ * Sets the object.
+ *
+ * @param object The object to set.
+ */
+ public void setObject(final Object object) {
+ _object = object;
+ }
+
+ /**
+ * Returns the proposed Class instance
+ *
+ * @return Returns the proposedClass.
+ */
+ public Class getProposedClass() {
+ return _proposedClass;
+ }
+
+ /**
+ * Sets the proposed Class instance.
+ *
+ * @param proposedClass The proposedClass to set.
+ */
+ public void setProposedClass(final Class proposedClass) {
+ _proposedClass = proposedClass;
+ }
+
+ /**
+ * True if the proposed class has been expanded.
+ *
+ * @return Returns the isExpanded.
+ */
+ public boolean isExpanded() {
+ return _isExpanded;
+ }
+
+ /**
+ * Set to true if the proposed class has been expanded.
+ *
+ * @param isExpanded The isExpanded to set.
+ */
+ public void setExpanded(final boolean isExpanded) {
+ _isExpanded = isExpanded;
+ }
+
+ /**
+ * Returns the actual Class instance.
+ *
+ * @return Returns the actualClass.
+ */
+ public Class getActualClass() {
+ return _actualClass;
+ }
+
+ /**
+ * Sets the actual Class instance.
+ *
+ * @param actualClass The actualClass to set.
+ */
+ public void setActualClass(final Class actualClass) {
+ _actualClass = actualClass;
+ }
+
+ /**
+ * Returns the ClassMolder associated with the actual object.
+ *
+ * @return The actual ClassMolder
+ */
+ public ClassMolder getActualClassMolder() {
+ return _actualClassMolder;
+ }
+
+ /**
+ * Sets the ClassMolder associated with the actual object
+ *
+ * @param actualClassMolder The ClassMolder associated with the actual object
+ */
+ public void setActualClassMolder(final ClassMolder actualClassMolder) {
+ _actualClassMolder = actualClassMolder;
+ }
+
+ /**
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("<");
+ buffer.append("proposedClass=" + _proposedClass);
+ buffer.append("; actualClass=" + _actualClass);
+ buffer.append("; object=" + _object);
+ buffer.append("; actual classmolder=" + _actualClassMolder + "; ");
+ if (_fields != null) {
+ for (int i = 0; i < _fields.length; i++) {
+ buffer.append("fields[" + i + "]='" + _fields[i] + "':");
+ }
+ }
+ buffer.append(">");
+ return buffer.toString();
+ }
+}
Index: tests/ctf/jdo/tc9x/Accommodation.java
===================================================================
RCS file: tests/ctf/jdo/tc9x/Accommodation.java
diff -N tests/ctf/jdo/tc9x/Accommodation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/ctf/jdo/tc9x/Accommodation.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2005 Werner Guttmann
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Id: TransactionContext.java,v 1.1 2005/06/20 12:00:59 wguttmn Exp $
+ *
+ */
+package ctf.jdo.tc9x;
+
+import org.exolab.castor.jdo.TimeStampable;
+
+public final class Accommodation extends Product1893 implements TimeStampable {
+ private String _bestSeason;
+
+ public String getBestSeason() {
+ return _bestSeason;
+ }
+
+ public void setBestSeason(final String bestSeason) {
+ _bestSeason = bestSeason;
+ }
+}
Index: tests/ctf/jdo/tc9x/Base.java
===================================================================
RCS file: tests/ctf/jdo/tc9x/Base.java
diff -N tests/ctf/jdo/tc9x/Base.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/ctf/jdo/tc9x/Base.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2005 Werner Guttmann
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Id: TransactionContext.java,v 1.1 2005/06/20 12:00:59 wguttmn Exp $
+ *
+ */
+package ctf.jdo.tc9x;
+
+public class Base {
+ private String _id;
+ private String _color;
+
+ public final String getId() { return _id; }
+ public final void setId(final String id) { _id = id; }
+
+ public final String getColor() { return _color; }
+ public final void setColor(final String color) { _color = color; }
+
+ public String toString() {
+ return super.toString() + " Base: id=" + _id + ",color=" + _color;
+ }
+}
Index: tests/ctf/jdo/tc9x/Car.java
===================================================================
RCS file: tests/ctf/jdo/tc9x/Car.java
diff -N tests/ctf/jdo/tc9x/Car.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/ctf/jdo/tc9x/Car.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2005 Werner Guttmann
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Id: TransactionContext.java,v 1.1 2005/06/20 12:00:59 wguttmn Exp $
+ *
+ */
+package ctf.jdo.tc9x;
+
+public class Car extends Product {
+ private int _kw;
+ private String _make;
+
+ public final int getKw() { return _kw; }
+ public final void setKw(final int kw) { _kw = kw; }
+
+ public final String getMake() { return _make; }
+ public final void setMake(final String make) { _make = make; }
+}
Index: tests/ctf/jdo/tc9x/CarKeyGen.java
===================================================================
RCS file: tests/ctf/jdo/tc9x/CarKeyGen.java
diff -N tests/ctf/jdo/tc9x/CarKeyGen.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/ctf/jdo/tc9x/CarKeyGen.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2005 Werner Guttmann
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Id: TransactionContext.java,v 1.1 2005/06/20 12:00:59 wguttmn Exp $
+ *
+ */
+package ctf.jdo.tc9x;
+
+public class CarKeyGen extends ProductKeyGen {
+ private int _kw;
+ private String _make;
+
+ public final int getKw() { return _kw; }
+ public final void setKw(final int kw) { _kw = kw; }
+
+ public final String getMake() { return _make; }
+ public final void setMake(final String make) { _make = make; }
+}
Index: tests/ctf/jdo/tc9x/ComposedProduct.java
===================================================================
RCS file: tests/ctf/jdo/tc9x/ComposedProduct.java
diff -N tests/ctf/jdo/tc9x/ComposedProduct.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/ctf/jdo/tc9x/ComposedProduct.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2005 Werner Guttmann
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Id: TransactionContext.java,v 1.1 2005/06/20 12:00:59 wguttmn Exp $
+ *
+ */
+package ctf.jdo.tc9x;
+
+import java.util.Iterator;
+import java.util.Vector;
+
+import org.exolab.castor.jdo.TimeStampable;
+
+public final class ComposedProduct extends Product1893 implements TimeStampable {
+ private String _name;
+ private Vector _subProducts = new Vector();
+ private long _timeStamp;
+
+ public String getExtraName() { return _name; }
+ public void setExtraName(final String name) { _name = name; }
+
+ public String getExtraDescription() { return _name; }
+ public void setExtraDescription(final String name) { _name = name; }
+
+ public Vector getSubProducts() { return _subProducts; }
+ public void setSubProducts(final Vector products) {
+ Iterator i = products.iterator();
+ while (i.hasNext()) {
+ ComposedProduct cp = (ComposedProduct) i.next();
+ if (!_subProducts.contains(cp)) {
+ _subProducts.add(cp);
+ cp.addComposition(this);
+ }
+ }
+ }
+ public void addSubProduct(final Product1893 product) {
+ if (!_subProducts.contains(product)) {
+ _subProducts.addElement(product);
+ product.addComposition(this);
+ }
+ }
+}
Index: tests/ctf/jdo/tc9x/Computer.java
===================================================================
RCS file: tests/ctf/jdo/tc9x/Computer.java
diff -N tests/ctf/jdo/tc9x/Computer.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/ctf/jdo/tc9x/Computer.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2005 Werner Guttmann
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Id: TransactionContext.java,v 1.1 2005/06/20 12:00:59 wguttmn Exp $
+ *
+ */
+package ctf.jdo.tc9x;
+
+public class Computer extends Product {
+ private String _cpu;
+
+ public final String getCpu() { return _cpu; }
+ public final void setCpu(final String cpu) { _cpu = cpu; }
+}
Index: tests/ctf/jdo/tc9x/ComputerKeyGen.java
===================================================================
RCS file: tests/ctf/jdo/tc9x/ComputerKeyGen.java
diff -N tests/ctf/jdo/tc9x/ComputerKeyGen.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/ctf/jdo/tc9x/ComputerKeyGen.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2005 Werner Guttmann
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Id: TransactionContext.java,v 1.1 2005/06/20 12:00:59 wguttmn Exp $
+ *
+ */
+package ctf.jdo.tc9x;
+
+public class ComputerKeyGen extends ProductKeyGen {
+ private String _cpu;
+
+ public final String getCpu() { return _cpu; }
+ public final void setCpu(final String cpu) { _cpu = cpu; }
+}
Index: tests/ctf/jdo/tc9x/ComputerMulti.java
===================================================================
RCS file: tests/ctf/jdo/tc9x/ComputerMulti.java
diff -N tests/ctf/jdo/tc9x/ComputerMulti.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/ctf/jdo/tc9x/ComputerMulti.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2005 Werner Guttmann
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Id: TransactionContext.java,v 1.1 2005/06/20 12:00:59 wguttmn Exp $
+ *
+ */
+package ctf.jdo.tc9x;
+
+public class ComputerMulti extends ProductMulti {
+ private String _cpu;
+
+ public final String getCpu() { return _cpu; }
+ public final void setCpu(final String cpu) { _cpu = cpu; }
+}
Index: tests/ctf/jdo/tc9x/Container.java
===================================================================
RCS file: tests/ctf/jdo/tc9x/Container.java
diff -N tests/ctf/jdo/tc9x/Container.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/ctf/jdo/tc9x/Container.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2005 Werner Guttmann
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Id: TransactionContext.java,v 1.1 2005/06/20 12:00:59 wguttmn Exp $
+ *
+ */
+package ctf.jdo.tc9x;
+
+public final class Container {
+ private String _id;
+ private Base _reference;
+
+ public String getId() { return _id; }
+ public void setId(final String id) { _id = id; }
+
+ public Base getReference() { return _reference; }
+ public void setReference(final Base reference) { _reference = reference; }
+
+ public String toString() {
+ return super.toString()
+ + "Container: id =" + _id + ",reference=[" + _reference + "]";
+ }
+}
Index: tests/ctf/jdo/tc9x/Craft.java
===================================================================
RCS file: tests/ctf/jdo/tc9x/Craft.java
diff -N tests/ctf/jdo/tc9x/Craft.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/ctf/jdo/tc9x/Craft.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2005 Werner Guttmann
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Id: TransactionContext.java,v 1.1 2005/06/20 12:00:59 wguttmn Exp $
+ *
+ */
+package ctf.jdo.tc9x;
+
+import org.exolab.castor.jdo.TimeStampable;
+
+public final class Craft extends Product1893 implements TimeStampable {
+ // no code, as only used in extend relations
+}
Index: tests/ctf/jdo/tc9x/Culture.java
===================================================================
RCS file: tests/ctf/jdo/tc9x/Culture.java
diff -N tests/ctf/jdo/tc9x/Culture.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/ctf/jdo/tc9x/Culture.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2005 Werner Guttmann
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Id: TransactionContext.java,v 1.1 2005/06/20 12:00:59 wguttmn Exp $
+ *
+ */
+package ctf.jdo.tc9x;
+
+import org.exolab.castor.jdo.TimeStampable;
+
+public final class Culture extends Product1893 implements TimeStampable {
+ // no code, as used only in extend relations
+}
Index: tests/ctf/jdo/tc9x/Derived.java
===================================================================
RCS file: tests/ctf/jdo/tc9x/Derived.java
diff -N tests/ctf/jdo/tc9x/Derived.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/ctf/jdo/tc9x/Derived.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2005 Werner Guttmann
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Id: TransactionContext.java,v 1.1 2005/06/20 12:00:59 wguttmn Exp $
+ *
+ */
+package ctf.jdo.tc9x;
+
+public final class Derived extends Base {
+ private String _scent;
+
+ public String getScent() { return _scent; }
+ public void setScent(final String scent) { _scent = scent; }
+
+ public String toString() {
+ return super.toString() + ", Derived: scent=" + _scent;
+ }
+}
Index: tests/ctf/jdo/tc9x/Laptop.java
===================================================================
RCS file: tests/ctf/jdo/tc9x/Laptop.java
diff -N tests/ctf/jdo/tc9x/Laptop.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/ctf/jdo/tc9x/Laptop.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2005 Werner Guttmann
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Id: TransactionContext.java,v 1.1 2005/06/20 12:00:59 wguttmn Exp $
+ *
+ */
+package ctf.jdo.tc9x;
+
+public final class Laptop extends Computer {
+ private int _weight;
+ private String _resolution;
+
+ public String getResolution() { return _resolution; }
+ public void setResolution(final String resolution) { _resolution = resolution; }
+
+ public int getWeight() { return _weight; }
+ public void setWeight(final int weight) { _weight = weight; }
+}
Index: tests/ctf/jdo/tc9x/LaptopKeyGen.java
===================================================================
RCS file: tests/ctf/jdo/tc9x/LaptopKeyGen.java
diff -N tests/ctf/jdo/tc9x/LaptopKeyGen.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/ctf/jdo/tc9x/LaptopKeyGen.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2005 Werner Guttmann
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Id: TransactionContext.java,v 1.1 2005/06/20 12:00:59 wguttmn Exp $
+ *
+ */
+package ctf.jdo.tc9x;
+
+public final class LaptopKeyGen extends ComputerKeyGen {
+ private int _weight;
+ private String _resolution;
+
+ public String getResolution() { return _resolution; }
+ public void setResolution(final String resolution) { _resolution = resolution; }
+
+ public int getWeight() { return _weight; }
+ public void setWeight(final int weight) { _weight = weight; }
+}
Index: tests/ctf/jdo/tc9x/LaptopMulti.java
===================================================================
RCS file: tests/ctf/jdo/tc9x/LaptopMulti.java
diff -N tests/ctf/jdo/tc9x/LaptopMulti.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/ctf/jdo/tc9x/LaptopMulti.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2005 Werner Guttmann
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Id: TransactionContext.java,v 1.1 2005/06/20 12:00:59 wguttmn Exp $
+ *
+ */
+package ctf.jdo.tc9x;
+
+public final class LaptopMulti extends ComputerMulti {
+ private int _weight;
+ private String _resolution;
+
+ public String getResolution() { return _resolution; }
+ public void setResolution(final String resolution) { _resolution = resolution; }
+
+ public int getWeight() { return _weight; }
+ public void setWeight(final int weight) { _weight = weight; }
+}
Index: tests/ctf/jdo/tc9x/M.java
===================================================================
RCS file: tests/ctf/jdo/tc9x/M.java
diff -N tests/ctf/jdo/tc9x/M.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/ctf/jdo/tc9x/M.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2005 Werner Guttmann
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Id: TransactionContext.java,v 1.1 2005/06/20 12:00:59 wguttmn Exp $
+ *
+ */
+package ctf.jdo.tc9x;
+
+import java.util.Collection;
+
+public final class M {
+ private int _id;
+ private String _name;
+ private Collection _ns;
+
+ public int getId() { return _id; }
+ public void setId(final int id) { _id = id; }
+
+ public String getName() { return _name; }
+ public void setName(final String name) { _name = name; }
+
+ public Collection getNs() { return _ns; }
+ public void setNs(final Collection ns) { _ns = ns; }
+}
Index: tests/ctf/jdo/tc9x/N.java
===================================================================
RCS file: tests/ctf/jdo/tc9x/N.java
diff -N tests/ctf/jdo/tc9x/N.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/ctf/jdo/tc9x/N.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2005 Werner Guttmann
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Id: TransactionContext.java,v 1.1 2005/06/20 12:00:59 wguttmn Exp $
+ *
+ */
+package ctf.jdo.tc9x;
+
+import java.util.Collection;
+
+public final class N {
+ private int _id;
+ private String _name;
+ private Collection _ms;
+
+ public int getId() { return _id; }
+ public void setId(final int id) { _id = id; }
+
+ public String getName() { return _name; }
+ public void setName(final String name) { _name = name; }
+
+ public Collection getMs() { return _ms; }
+ public void setMs(final Collection ms) { _ms = ms; }
+}
Index: tests/ctf/jdo/tc9x/Order.java
===================================================================
RCS file: tests/ctf/jdo/tc9x/Order.java
diff -N tests/ctf/jdo/tc9x/Order.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/ctf/jdo/tc9x/Order.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2005 Werner Guttmann
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Id: TransactionContext.java,v 1.1 2005/06/20 12:00:59 wguttmn Exp $
+ *
+ */
+package ctf.jdo.tc9x;
+
+import java.util.Collection;
+
+public final class Order {
+ private int _id;
+ private String _name;
+ private Collection _products;
+
+ public int getId() { return _id; }
+ public void setId(final int id) { _id = id; }
+
+ public String getName() { return _name; }
+ public void setName(final String name) { _name = name; }
+
+ public Collection getProducts() { return _products; }
+ public void setProducts(final Collection products) { _products = products; }
+}
Index: tests/ctf/jdo/tc9x/Owner.java
===================================================================
RCS file: tests/ctf/jdo/tc9x/Owner.java
diff -N tests/ctf/jdo/tc9x/Owner.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/ctf/jdo/tc9x/Owner.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2005 Werner Guttmann
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Id: TransactionContext.java,v 1.1 2005/06/20 12:00:59 wguttmn Exp $
+ *
+ */
+package ctf.jdo.tc9x;
+
+public final class Owner {
+ private int _id;
+ private String _name;
+ private Product _product;
+
+ public int getId() { return _id; }
+ public void setId(final int id) { _id = id; }
+
+ public String getName() { return _name; }
+ public void setName(final String name) { _name = name; }
+
+ public Product getProduct() { return _product; }
+ public void setProduct(final Product product) { _product = product; }
+}
Index: tests/ctf/jdo/tc9x/Product.java
===================================================================
RCS file: tests/ctf/jdo/tc9x/Product.java
diff -N tests/ctf/jdo/tc9x/Product.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/ctf/jdo/tc9x/Product.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2005 Werner Guttmann
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Id: TransactionContext.java,v 1.1 2005/06/20 12:00:59 wguttmn Exp $
+ */
+package ctf.jdo.tc9x;
+
+import java.util.Collection;
+
+import org.exolab.castor.jdo.TimeStampable;
+
+public class Product implements TimeStampable {
+ private int _id;
+ private String _name;
+ private ProductDetail _detail;
+ private Collection _orders;
+ private Collection _owners;
+ private long _timeStamp;
+
+ public final int getId() { return _id; }
+ public final void setId(final int id) { _id = id; }
+
+ public final String getName() { return _name; }
+ public final void setName(final String name) { _name = name; }
+
+ public final ProductDetail getDetail() { return _detail; }
+ public final void setDetail(final ProductDetail detail) { _detail = detail; }
+
+ public final Collection getOrders() { return _orders; }
+ public final void setOrders(final Collection orders) { _orders = orders; }
+
+ public final Collection getOwners() { return _owners; }
+ public final void setOwners(final Collection owners) { _owners = owners; }
+
+ /**
+ * @see org.exolab.castor.jdo.TimeStampable#jdoSetTimeStamp(long)
+ */
+ public final void jdoSetTimeStamp(final long timestamp) {
+ _timeStamp = timestamp;
+ }
+
+ /**
+ * @see org.exolab.castor.jdo.TimeStampable#jdoGetTimeStamp()
+ */
+ public final long jdoGetTimeStamp() {
+ return _timeStamp;
+ }
+}
Index: tests/ctf/jdo/tc9x/Product1893.java
===================================================================
RCS file: tests/ctf/jdo/tc9x/Product1893.java
diff -N tests/ctf/jdo/tc9x/Product1893.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/ctf/jdo/tc9x/Product1893.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2005 Werner Guttmann
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Id: TransactionContext.java,v 1.1 2005/06/20 12:00:59 wguttmn Exp $
+ *
+ */
+package ctf.jdo.tc9x;
+
+import java.util.Iterator;
+import java.util.Vector;
+
+import org.exolab.castor.jdo.TimeStampable;
+
+public class Product1893 implements TimeStampable {
+ private int _id;
+ private String _name;
+ private String _desc;
+ private Vector _composition = new Vector();
+ private long _timeStamp;
+
+ public final int getId() { return _id; }
+ public final void setId(final int id) { _id = id; }
+
+ public final String getName() { return _name; }
+ public final void setName(final String name) { _name = name; }
+
+ public final String getDescription() { return _desc; }
+ public final void setDescription(final String desc) { _desc = desc; }
+
+ public final Vector getCompositions() { return _composition; }
+ public final void setCompositions(final Vector products) {
+ Iterator iter = products.iterator();
+ while (iter.hasNext()) {
+ ComposedProduct cp = (ComposedProduct) iter.next();
+ if (!_composition.contains(cp)) {
+ _composition.add(cp);
+ cp.addSubProduct(this);
+ }
+ }
+ }
+ public final void addComposition(final ComposedProduct product) {
+ if (!_composition.contains(product)) {
+ _composition.addElement(product);
+ product.addSubProduct(this);
+ }
+ }
+
+ /**
+ * @see org.exolab.castor.jdo.TimeStampable#jdoSetTimeStamp(long)
+ */
+ public final void jdoSetTimeStamp(final long timeStamp) {
+ _timeStamp = timeStamp;
+ }
+
+ /**
+ * @see org.exolab.castor.jdo.TimeStampable#jdoGetTimeStamp()
+ */
+ public final long jdoGetTimeStamp() {
+ return _timeStamp;
+ }
+
+ public String toString() {
+ return "";
+ }
+}
Index: tests/ctf/jdo/tc9x/ProductDetail.java
===================================================================
RCS file: tests/ctf/jdo/tc9x/ProductDetail.java
diff -N tests/ctf/jdo/tc9x/ProductDetail.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/ctf/jdo/tc9x/ProductDetail.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2005 Werner Guttmann
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Id: TransactionContext.java,v 1.1 2005/06/20 12:00:59 wguttmn Exp $
+ *
+ */
+package ctf.jdo.tc9x;
+
+public final class ProductDetail {
+ private int _id;
+ private String _category;
+ private String _location;
+
+ public int getId() { return _id; }
+ public void setId(final int id) { _id = id; }
+
+ public String getCategory() { return _category; }
+ public void setCategory(final String category) { _category = category; }
+
+ public String getLocation() { return _location; }
+ public void setLocation(final String location) { _location = location; }
+}
Index: tests/ctf/jdo/tc9x/ProductKeyGen.java
===================================================================
RCS file: tests/ctf/jdo/tc9x/ProductKeyGen.java
diff -N tests/ctf/jdo/tc9x/ProductKeyGen.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/ctf/jdo/tc9x/ProductKeyGen.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2005 Werner Guttmann
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Id: TransactionContext.java,v 1.1 2005/06/20 12:00:59 wguttmn Exp $
+ *
+ */
+package ctf.jdo.tc9x;
+
+import java.util.Collection;
+
+public class ProductKeyGen {
+ private int _id;
+ private String _name;
+ private ProductDetail _detail;
+ private Collection _orders;
+
+ public final int getId() { return _id; }
+ public final void setId(final int id) { _id = id; }
+
+ public final String getName() { return _name; }
+ public final void setName(final String name) { _name = name; }
+
+ public final ProductDetail getDetail() { return _detail; }
+ public final void setDetail(final ProductDetail detail) { _detail = detail; }
+
+ public final Collection getOrders() { return _orders; }
+ public final void setOrders(final Collection orders) { _orders = orders; }
+}
Index: tests/ctf/jdo/tc9x/ProductMulti.java
===================================================================
RCS file: tests/ctf/jdo/tc9x/ProductMulti.java
diff -N tests/ctf/jdo/tc9x/ProductMulti.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/ctf/jdo/tc9x/ProductMulti.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2005 Werner Guttmann
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Id: TransactionContext.java,v 1.1 2005/06/20 12:00:59 wguttmn Exp $
+ *
+ */
+package ctf.jdo.tc9x;
+
+public class ProductMulti {
+ private int _id1;
+ private int _id2;
+ private String _name;
+ private ProductDetail _detail;
+
+ public final int getId1() { return _id1; }
+ public final void setId1(final int id1) { _id1 = id1; }
+
+ public final int getId2() { return _id2; }
+ public final void setId2(final int id2) { _id2 = id2; }
+
+ public final String getName() { return _name; }
+ public final void setName(final String name) { _name = name; }
+
+ public final ProductDetail getDetail() { return _detail; }
+ public final void setDetail(final ProductDetail detail) { _detail = detail; }
+}
Index: tests/ctf/jdo/tc9x/Server.java
===================================================================
RCS file: tests/ctf/jdo/tc9x/Server.java
diff -N tests/ctf/jdo/tc9x/Server.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/ctf/jdo/tc9x/Server.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2005 Werner Guttmann
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Id: TransactionContext.java,v 1.1 2005/06/20 12:00:59 wguttmn Exp $
+ *
+ */
+package ctf.jdo.tc9x;
+
+public final class Server extends Computer {
+ private int _numberOfCPUs;
+ private int _supportInYears;
+
+ public int getNumberOfCPUs() { return _numberOfCPUs; }
+ public void setNumberOfCPUs(final int numberOfCPUs) {
+ _numberOfCPUs = numberOfCPUs;
+ }
+
+ public int getSupportInYears() { return _supportInYears; }
+ public void setSupportInYears(final int supportInYears) {
+ _supportInYears = supportInYears;
+ }
+}
Index: tests/ctf/jdo/tc9x/ServerKeyGen.java
===================================================================
RCS file: tests/ctf/jdo/tc9x/ServerKeyGen.java
diff -N tests/ctf/jdo/tc9x/ServerKeyGen.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/ctf/jdo/tc9x/ServerKeyGen.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2005 Werner Guttmann
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Id: TransactionContext.java,v 1.1 2005/06/20 12:00:59 wguttmn Exp $
+ *
+ */
+package ctf.jdo.tc9x;
+
+public final class ServerKeyGen extends ComputerKeyGen {
+ private int _numberOfCPUs;
+ private int _supportInYears;
+
+ public int getNumberOfCPUs() { return _numberOfCPUs; }
+ public void setNumberOfCPUs(final int numberOfCPUs) {
+ _numberOfCPUs = numberOfCPUs;
+ }
+
+ public int getSupportInYears() { return _supportInYears; }
+ public void setSupportInYears(final int supportInYears) {
+ _supportInYears = supportInYears;
+ }
+}
Index: tests/ctf/jdo/tc9x/ServerMulti.java
===================================================================
RCS file: tests/ctf/jdo/tc9x/ServerMulti.java
diff -N tests/ctf/jdo/tc9x/ServerMulti.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/ctf/jdo/tc9x/ServerMulti.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2005 Werner Guttmann
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Id: TransactionContext.java,v 1.1 2005/06/20 12:00:59 wguttmn Exp $
+ *
+ */
+package ctf.jdo.tc9x;
+
+public final class ServerMulti extends ComputerMulti {
+ private int _numberOfCPUs;
+ private int _supportInYears;
+
+ public int getNumberOfCPUs() { return _numberOfCPUs; }
+ public void setNumberOfCPUs(final int numberOfCPUs) {
+ _numberOfCPUs = numberOfCPUs;
+ }
+
+ public int getSupportInYears() { return _supportInYears; }
+ public void setSupportInYears(final int supportInYears) {
+ _supportInYears = supportInYears;
+ }
+}
Index: tests/ctf/jdo/tc9x/TestPolymorphism.java
===================================================================
RCS file: tests/ctf/jdo/tc9x/TestPolymorphism.java
diff -N tests/ctf/jdo/tc9x/TestPolymorphism.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/ctf/jdo/tc9x/TestPolymorphism.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,533 @@
+/*
+ * Copyright 2005 Werner Guttmann
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Id: TransactionContext.java,v 1.1 2005/06/20 12:00:59 wguttmn Exp $
+ *
+ */
+package ctf.jdo.tc9x;
+
+import java.util.Collection;
+import java.util.LinkedList;
+
+import harness.CastorTestCase;
+import harness.TestHarness;
+
+import jdo.JDOCategory;
+
+import org.exolab.castor.jdo.Database;
+import org.exolab.castor.jdo.OQLQuery;
+import org.exolab.castor.jdo.ObjectNotFoundException;
+import org.exolab.castor.jdo.QueryResults;
+import org.exolab.castor.persist.spi.Complex;
+
+/**
+ * Tests that modification to read only objects are not persist in the
+ * database.
+ */
+public final class TestPolymorphism extends CastorTestCase {
+
+ private JDOCategory _category;
+
+ /**
+ * Constructor
+ * @param category the test suite that this test case belongs
+ */
+ public TestPolymorphism(final TestHarness category) {
+ super(category, "TC97", "Polymorphism tests");
+ _category = (JDOCategory) category;
+ }
+
+ /**
+ * Tests that modification to read only objects are not persist in the
+ * database.
+ */
+ public void runTest() throws Exception {
+ testLoadLaptop();
+ testCreateAndLoadLaptop();
+ testLoadLaptopMulti();
+ testLoadServer();
+ testLoadServerMulti();
+ testLoadComputer();
+ testCreateAndLoadComputer();
+ testLoadComputerMulti();
+ testLoadTruck();
+ testLoadCar();
+ testCreateAndLoadCar();
+ testLoadOwner();
+ testLoadM();
+ testQueryOwner();
+ testQueryComputers();
+ testQueryLaptops();
+ testQueryServers();
+ testQueryProducts();
+ }
+
+ public void testLoadLaptop() throws Exception {
+ Database database = _category.getDatabase();
+
+ database.begin();
+ Laptop laptop = (Laptop) database.load(Laptop.class, new Integer(1));
+ database.commit();
+
+ assertNotNull(laptop);
+ assertEquals("ctf.jdo.tc9x.Laptop", laptop.getClass().getName());
+ assertEquals(1, laptop.getId());
+ assertEquals("laptop 1", laptop.getName());
+
+ database.close();
+ }
+
+ public void testCreateAndLoadLaptop() throws Exception {
+ Database database = _category.getDatabase();
+
+ database.begin();
+ ProductDetail detail = new ProductDetail();
+ detail.setId(10);
+ detail.setCategory("category 10");
+ detail.setLocation("location 10");
+ database.create(detail);
+ database.commit();
+
+ database.begin();
+ Laptop laptop = new Laptop();
+ laptop.setId(10);
+ laptop.setName("laptop 10");
+ laptop.setCpu("centrino");
+ laptop.setResolution("1600");
+ laptop.setWeight(2750);
+ laptop.setDetail((ProductDetail) database.load(
+ ProductDetail.class, new Integer(10)));
+ database.create(laptop);
+ database.commit();
+
+ database.begin();
+ laptop = (Laptop) database.load (Laptop.class, new Integer(10));
+ database.commit();
+
+ assertNotNull (laptop);
+ assertEquals("ctf.jdo.tc9x.Laptop", laptop.getClass().getName());
+ assertEquals(10, laptop.getId());
+ assertEquals("laptop 10", laptop.getName());
+
+ database.begin();
+ database.remove(database.load(Laptop.class, new Integer(10)));
+ database.remove(database.load(ProductDetail.class, new Integer(10)));
+ database.commit();
+
+ database.begin();
+ try {
+ laptop = (Laptop) database.load(Laptop.class, new Integer(10));
+ fail("Laptop with id 10 still exists.");
+ } catch (ObjectNotFoundException e) {
+ assertEquals("The object of type ctf.jdo.tc9x.Laptop with identity 10 "
+ + "was not found in persistent storage", e.getMessage());
+ }
+ database.commit();
+
+ database.close();
+ }
+
+ public void testLoadLaptopMulti() throws Exception {
+ Database database = _category.getDatabase();
+
+ database.begin();
+ LaptopMulti laptop = (LaptopMulti) database.load(LaptopMulti.class,
+ new Complex(new Integer (1), new Integer(1)));
+ database.commit();
+
+ assertNotNull(laptop);
+ assertEquals("ctf.jdo.tc9x.LaptopMulti", laptop.getClass().getName());
+ assertEquals("laptop 1", laptop.getName());
+ assertEquals(1, laptop.getId1());
+ assertEquals(1, laptop.getId2());
+
+ database.close();
+ }
+
+ public void testLoadServer() throws Exception {
+ Database database = _category.getDatabase();
+
+ database.begin();
+ Server server = (Server) database.load(Server.class, new Integer(3));
+ database.commit();
+
+ assertNotNull(server);
+ assertEquals("ctf.jdo.tc9x.Server", server.getClass().getName());
+ assertEquals(3, server.getId());
+ assertEquals("server 3", server.getName());
+
+ database.close();
+ }
+
+ public void testLoadServerMulti() throws Exception {
+ Database database = _category.getDatabase();
+
+ database.begin();
+ ServerMulti server = (ServerMulti) database.load(ServerMulti.class,
+ new Complex(new Integer(3), new Integer(3)));
+ database.commit();
+
+ assertNotNull(server);
+ assertEquals("ctf.jdo.tc9x.ServerMulti", server.getClass().getName());
+ assertEquals(3, server.getId1());
+ assertEquals(3, server.getId2());
+ assertEquals("server 3", server.getName());
+
+ database.close();
+ }
+
+ public void testLoadComputer() throws Exception {
+ Database database = _category.getDatabase();
+
+ database.begin();
+ Computer computer = (Computer) database.load(Computer.class, new Integer(2));
+ database.commit();
+
+ assertNotNull(computer);
+ assertEquals("ctf.jdo.tc9x.Laptop", computer.getClass().getName());
+ assertEquals(2, computer.getId());
+ assertEquals("laptop 2", computer.getName());
+
+ database.close();
+ }
+
+ public void testCreateAndLoadComputer() throws Exception {
+ Database database = _category.getDatabase();
+
+ database.begin();
+ Order order = new Order();
+ order.setId(12);
+ order.setName("order 12");
+ database.create(order);
+ database.commit();
+
+ database.begin();
+ ProductDetail detail = new ProductDetail();
+ detail.setId(12);
+ detail.setCategory("category 12");
+ detail.setLocation("location 12");
+ database.create(detail);
+ database.commit();
+
+ database.begin();
+ Laptop laptop = new Laptop();
+ laptop.setId(12);
+ laptop.setName("laptop 12");
+ laptop.setCpu("centrino");
+ laptop.setResolution("1600");
+ laptop.setWeight(2450);
+ laptop.setDetail((ProductDetail)
+ database.load(ProductDetail.class, new Integer(12)));
+ database.create(laptop);
+ Collection orders = new LinkedList();
+ orders.add(database.load(Order.class, new Integer(12)));
+ laptop.setOrders(orders);
+ database.commit();
+
+ database.begin();
+ Computer computer = (Computer) database.load(Computer.class, new Integer(12));
+ database.commit();
+
+ assertNotNull(computer);
+ assertEquals("ctf.jdo.tc9x.Laptop", computer.getClass().getName());
+ assertEquals(12, computer.getId());
+ assertEquals("laptop 12", computer.getName());
+
+ database.begin();
+ database.remove(database.load(Computer.class, new Integer(12)));
+ database.remove(database.load (ProductDetail.class, new Integer(12)));
+ database.remove(database.load(Order.class, new Integer(12)));
+ database.commit();
+
+ database.close();
+ }
+
+ public void testLoadComputerMulti() throws Exception {
+ Database database = _category.getDatabase();
+
+ database.begin();
+ ComputerMulti computer = (LaptopMulti) database.load(ComputerMulti.class,
+ new Complex(new Integer(1), new Integer(1)));
+ database.commit();
+
+ assertNotNull(computer);
+ assertEquals(1, computer.getId1());
+ assertEquals(1, computer.getId2());
+ assertEquals("laptop 1", computer.getName());
+
+ database.close();
+ }
+
+ public void testLoadTruck() throws Exception {
+ Database database = _category.getDatabase();
+
+ database.begin();
+ Truck truck = (Truck) database.load(Truck.class, new Integer(5));
+ database.commit();
+
+ assertNotNull(truck);
+ assertEquals(5, truck.getId());
+
+ database.close();
+ }
+
+ public void testLoadCar() throws Exception {
+ Database database = _category.getDatabase();
+
+ database.begin();
+ Object object = database.load(Car.class, new Integer(5));
+ assertNotNull (object);
+ assertEquals ("ctf.jdo.tc9x.Truck", object.getClass().getName());
+ Truck truck = (Truck) object;
+ database.commit();
+
+ assertNotNull(truck);
+ assertEquals(5, truck.getId());
+
+ database.close();
+ }
+
+ public void testCreateAndLoadCar() throws Exception {
+ Database database = _category.getDatabase();
+
+ database.begin();
+ Order order = new Order();
+ order.setId(11);
+ order.setName("order 11");
+ database.create(order);
+ database.commit();
+
+ database.begin();
+ ProductDetail detail = new ProductDetail();
+ detail.setId(11);
+ detail.setCategory("category 11");
+ detail.setLocation("location 11");
+ database.create(detail);
+ database.commit();
+
+ database.begin();
+ Truck truck = new Truck();
+ truck.setId(11);
+ truck.setName("truck 11");
+ truck.setKw(112);
+ truck.setMake("Fiat");
+ truck.setMaxWeight(3750);
+ truck.setDetail((ProductDetail)
+ database.load(ProductDetail.class, new Integer(11)));
+ database.create(truck);
+ Collection orders = new LinkedList();
+ orders.add(database.load(Order.class, new Integer(11)));
+ truck.setOrders(orders);
+ database.commit();
+
+ database.begin();
+ Object object = database.load(Car.class, new Integer(11));
+ assertNotNull(object);
+ assertEquals("ctf.jdo.tc9x.Truck", object.getClass().getName());
+ Truck loadedTruck = (Truck) object;
+ database.commit();
+
+ assertNotNull(loadedTruck);
+ assertEquals(11, loadedTruck.getId());
+
+ database.begin();
+ database.remove(database.load (Car.class, new Integer(11)));
+ database.remove(database.load (ProductDetail.class, new Integer(11)));
+ database.remove(database.load(Order.class, new Integer(11)));
+ database.commit();
+
+ database.close();
+ }
+
+ public void testLoadOwner() throws Exception {
+ Database database = _category.getDatabase();
+
+ database.begin();
+ Owner owner = (Owner) database.load(Owner.class, new Integer(1));
+ database.commit();
+
+ assertNotNull(owner);
+ assertEquals(1, owner.getId());
+ assertEquals("owner 1", owner.getName());
+
+ Product product = owner.getProduct();
+ assertNotNull(product);
+ assertEquals(1, product.getId());
+ assertEquals("ctf.jdo.tc9x.Laptop", product.getClass().getName());
+
+ database.close();
+ }
+
+ public void testLoadM() throws Exception {
+ Database database = _category.getDatabase();
+
+ database.begin();
+ M m = (M) database.load(M.class, new Integer(1));
+ database.commit();
+
+ assertNotNull(m);
+ assertEquals(1, m.getId());
+ assertEquals("m1", m.getName());
+
+ Collection ns = m.getNs();
+ assertNotNull(ns);
+ assertEquals(2, ns.size());
+
+ database.close();
+ }
+
+ public void testQueryOwner () throws Exception {
+ Database database = _category.getDatabase();
+
+ database.begin();
+ OQLQuery query = database.getOQLQuery("select owner from "
+ + Owner.class.getName() + " as owner");
+ QueryResults results = query.execute();
+
+ if (results.hasMore()) {
+ int counter = 1;
+ while (results.hasMore()) {
+ Owner owner = (Owner) results.next();
+ assertNotNull(owner);
+ assertEquals(counter, owner.getId());
+
+ counter += 1;
+ }
+ } else {
+ fail("Query does not return any Computer instances.");
+ }
+ database.commit();
+
+ database.close();
+ }
+
+ public void testQueryComputers () throws Exception {
+ String[] classNames = {
+ "ctf.jdo.tc9x.Laptop",
+ "ctf.jdo.tc9x.Laptop",
+ "ctf.jdo.tc9x.Server",
+ "ctf.jdo.tc9x.Server"
+ };
+
+ Database database = _category.getDatabase();
+
+ database.begin();
+ OQLQuery query = database.getOQLQuery("select computer from "
+ + Computer.class.getName() + " as computer order by computer.id");
+ QueryResults results = query.execute();
+
+ if (results.hasMore()) {
+ int counter = 1;
+ while (results.hasMore()) {
+ Computer computer = (Computer) results.next();
+ assertNotNull(computer);
+ assertEquals(counter, computer.getId());
+ assertEquals(classNames[counter - 1], computer.getClass().getName());
+
+ counter += 1;
+ }
+ } else {
+ fail("Query does not return any Computer instances.");
+ }
+ database.commit();
+
+ database.close();
+ }
+
+ public void testQueryLaptops () throws Exception {
+ Database database = _category.getDatabase();
+
+ database.begin();
+ OQLQuery query = database.getOQLQuery("select l from "
+ + Laptop.class.getName() + " as l order by l.id");
+ QueryResults results = query.execute();
+
+ if (results.hasMore()) {
+ int counter = 1;
+ Laptop laptop = null;
+ while (results.hasMore()) {
+ laptop = (Laptop) results.next();
+ assertNotNull(laptop);
+ assertEquals(counter, laptop.getId());
+
+ counter += 1;
+ }
+ } else {
+ fail("Query does not return any Laptop instances.");
+ }
+ database.commit();
+
+ database.close();
+ }
+
+ public void testQueryServers () throws Exception {
+ Database database = _category.getDatabase();
+
+ database.begin();
+ OQLQuery query = database.getOQLQuery("select s from "
+ + Server.class.getName() + " as s order by s.id");
+ QueryResults results = query.execute();
+
+ if (results.hasMore()) {
+ int counter = 3;
+ while (results.hasMore()) {
+ Server server = (Server) results.next();
+ assertNotNull(server);
+ assertEquals(counter, server.getId());
+
+ counter += 1;
+ }
+ } else {
+ fail("Query does not return any Server instances.");
+ }
+ database.commit();
+
+ database.close();
+ }
+
+ public void testQueryProducts () throws Exception {
+ String[] classNames = {
+ "ctf.jdo.tc9x.Laptop",
+ "ctf.jdo.tc9x.Laptop",
+ "ctf.jdo.tc9x.Server",
+ "ctf.jdo.tc9x.Server",
+ "ctf.jdo.tc9x.Truck"
+ };
+
+ Database database = _category.getDatabase();
+
+ database.begin();
+ OQLQuery query = database.getOQLQuery("select product from "
+ + Product.class.getName() + " as product order by product.id");
+ QueryResults results = query.execute();
+
+ if (results.hasMore()) {
+ int counter = 1;
+ while (results.hasMore()) {
+ Product product = (Product) results.next();
+ assertNotNull(product);
+ assertEquals(counter, product.getId());
+ assertEquals(classNames[counter - 1], product.getClass().getName());
+
+ counter += 1;
+ }
+ } else {
+ fail("Query does not return any Product instances.");
+ }
+ database.commit();
+
+ database.close();
+ }
+}
Index: tests/ctf/jdo/tc9x/TestPolymorphismInAThreadedEnvironment.java
===================================================================
RCS file: tests/ctf/jdo/tc9x/TestPolymorphismInAThreadedEnvironment.java
diff -N tests/ctf/jdo/tc9x/TestPolymorphismInAThreadedEnvironment.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/ctf/jdo/tc9x/TestPolymorphismInAThreadedEnvironment.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,169 @@
+/*
+ * Copyright 2005 Werner Guttmann
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Id: TransactionContext.java,v 1.1 2005/06/20 12:00:59 wguttmn Exp $
+ *
+ */
+package ctf.jdo.tc9x;
+
+import harness.CastorTestCase;
+import harness.TestHarness;
+
+import jdo.JDOCategory;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.exolab.castor.jdo.Database;
+
+/**
+ * Tests that modification to read only objects are not persist in the
+ * database.
+ */
+public final class TestPolymorphismInAThreadedEnvironment extends CastorTestCase {
+
+ private static final Log LOG =
+ LogFactory.getLog(TestPolymorphismInAThreadedEnvironment.class);
+
+ private static final int REPS = 100;
+
+ private JDOCategory _category;
+
+ /**
+ * Constructor
+ * @param category the test suite that this test case belongs
+ */
+ public TestPolymorphismInAThreadedEnvironment(final TestHarness category) {
+ super(category, "TC98", "Polymorphism tests in a threaded environment");
+ _category = (JDOCategory) category;
+ }
+
+ /**
+ * Tests that modification to read only objects are not persist in the
+ * database.
+ */
+ public void runTest() throws Exception {
+ testLoadContainer();
+ testLoadDerived();
+ testLoadContainerThenDerived();
+ testLoadContainerAndDerivedThreaded();
+ }
+
+ protected Container loadContainer() throws Exception {
+ Database db = _category.getDatabase();
+ db.begin();
+ Container container;
+ try {
+ container = (Container) db.load(Container.class, "200");
+ db.commit();
+ } catch (Exception ex) {
+ db.rollback();
+ throw ex;
+ } finally {
+ db.close();
+ }
+ return container;
+ }
+
+ private Derived loadDerived() throws Exception {
+ Database db = _category.getDatabase();
+ db.begin();
+ Derived derived;
+ try {
+ derived = (Derived) db.load(Derived.class, "100");
+ db.commit();
+ } catch (Exception ex) {
+ db.rollback();
+ throw ex;
+ } finally {
+ db.close();
+ }
+ return derived;
+ }
+
+ private Container loadContainerThenDerived() throws Exception {
+ Database db = _category.getDatabase();
+ db.begin();
+ Container container = null;
+ Derived derived = null;
+ try {
+ container = (Container) db.load(Container.class, "200");
+ derived = (Derived) db.load(Derived.class, "100");
+ db.commit();
+ } catch (Exception ex) {
+ db.rollback();
+ throw ex;
+ } finally {
+ db.close();
+ }
+ return container;
+ }
+
+ public void testLoadContainer() throws Exception {
+ LOG.debug("First we load a Container in its own transaction");
+ Object o = loadContainer();
+ LOG.debug("loadContainer: " + o);
+ }
+
+ public void testLoadDerived() throws Exception {
+ LOG.debug("Second we load a Derived in its own transaction");
+ Object o = loadDerived();
+ LOG.debug("loadDerived: " + o);
+ }
+
+ public void testLoadContainerThenDerived() throws Exception {
+ LOG.debug("Third we load a Container and a Derived in one transaction");
+ Object o = loadContainerThenDerived();
+ LOG.debug("loadContainerThenDerived: " + o);
+ }
+
+ public void testLoadContainerAndDerivedThreaded() {
+ int count = 0;
+ try {
+ LOG.debug("Forth we load Container and Derived in seperate "
+ + "threads in their own transactions");
+
+ Thread thread = new Thread(new TreadedContainerLoader());
+ thread.start();
+
+ for (int i = 0; i < REPS; i++) {
+ count = i;
+ loadDerived();
+ }
+ LOG.debug("First thread successfully loaded " + (count + 1) + " Derived");
+
+ thread.join();
+ } catch (Exception ex) {
+ LOG.error("Exception on first thread loading Derived on "
+ + (count + 1) + "th try", ex);
+ }
+ }
+
+ class TreadedContainerLoader implements Runnable {
+ public void run() {
+ int count = 0;
+ try {
+ for (int i = 0; i < REPS; i++) {
+ count = i;
+ loadContainer();
+ }
+ LOG.debug("Second thread successfully loaded " + (count + 1)
+ + " Containers");
+ } catch (Exception ex) {
+ LOG.error("Exception on second thread loading Container on "
+ + (count + 1) + "th try", ex);
+ }
+ }
+ }
+}
Index: tests/ctf/jdo/tc9x/TestPolymorphismMany2Many.java
===================================================================
RCS file: tests/ctf/jdo/tc9x/TestPolymorphismMany2Many.java
diff -N tests/ctf/jdo/tc9x/TestPolymorphismMany2Many.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/ctf/jdo/tc9x/TestPolymorphismMany2Many.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,199 @@
+/*
+ * Copyright 2005 Werner Guttmann
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Id: TransactionContext.java,v 1.1 2005/06/20 12:00:59 wguttmn Exp $
+ *
+ */
+package ctf.jdo.tc9x;
+
+import harness.CastorTestCase;
+import harness.TestHarness;
+
+import jdo.JDOCategory;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.exolab.castor.jdo.Database;
+
+/**
+ * Tests that modification to read only objects are not persist in the
+ * database.
+ */
+public final class TestPolymorphismMany2Many extends CastorTestCase {
+ /**
+ * The Jakarta
+ * Commons Logging instance used for all logging.
+ */
+ private static final Log LOG = LogFactory.getLog(TestPolymorphismMany2Many.class);
+
+ private static final String NEW_VALUE = "new value";
+
+ private JDOCategory _category;
+
+ private Database _db;
+
+ /**
+ * Constructor
+ *
+ * @param category the test suite that this test case belongs
+ */
+ public TestPolymorphismMany2Many(final TestHarness category) {
+ super(category, "TC99", "Polymorphism tests (many 2 many)");
+ _category = (JDOCategory) category;
+ }
+
+ /**
+ * Tests that modification to read only objects are not persist in the
+ * database.
+ */
+ public void runTest() throws Exception {
+ testCreateProd();
+ testCreateCrafts();
+ testCreateCulture();
+ testCreateAccomodation();
+ testCreateComposed();
+ testComposeOffer();
+ }
+
+ public void testCreateProd() throws Exception {
+ Database db = _category.getDatabase();
+ db.setAutoStore(true);
+ db.begin();
+
+ Product1893 pd1 = new Product1893();
+ pd1.setName("Product-1");
+ pd1.setDescription("Product-1: <30");
+ db.create(pd1);
+
+ Product1893 pd2 = new Product1893();
+ pd2.setName("Product-2");
+ pd2.setDescription("Product-2: <30");
+ db.create(pd2);
+
+ db.commit();
+ db.close();
+ }
+
+ public void testCreateCrafts() throws Exception {
+ Database db = _category.getDatabase();
+ db.setAutoStore(true);
+ db.begin();
+
+ Craft crf1 = new Craft();
+ crf1.setName("Craft-1");
+ crf1.setDescription("Craft-1: <30");
+ db.create(crf1);
+
+ Craft crf2 = new Craft();
+ crf2.setName("Craft-2");
+ crf2.setDescription("Craft-2: <30");
+ db.create(crf2);
+
+ db.commit();
+ db.close();
+ }
+
+ public void testCreateCulture() throws Exception {
+ Database db = _category.getDatabase();
+ db.setAutoStore(true);
+ db.begin();
+
+ Culture cult1 = new Culture();
+ cult1.setName("Culture-1");
+ cult1.setDescription("Culture-1: <30");
+ db.create(cult1);
+
+ Culture cult2 = new Culture();
+ cult2.setName("Culture-2");
+ cult2.setDescription("Culture-2: <30");
+ db.create(cult2);
+
+ db.commit();
+ db.close();
+ }
+
+ public void testCreateAccomodation() throws Exception {
+ Database db = _category.getDatabase();
+ db.setAutoStore(true);
+ db.begin();
+
+ Accommodation acc1 = new Accommodation();
+ acc1.setName("Accommodation-1");
+ acc1.setDescription("Accommodation-1: <30");
+ acc1.setBestSeason("Season-1");
+ db.create(acc1);
+
+ Accommodation acc2 = new Accommodation();
+ acc2.setName("Accommodation-2");
+ acc2.setDescription("Accommodation-2: <30");
+ acc2.setBestSeason("Season-2");
+ db.create(acc2);
+
+ db.commit();
+ db.close();
+ }
+
+ public void testCreateComposed() throws Exception {
+ Database db = _category.getDatabase();
+ db.setAutoStore(true);
+ db.begin();
+
+ ComposedProduct compp1 = new ComposedProduct();
+ compp1.setName("Composition-1");
+ compp1.setExtraName("Xtra-Composition-1");
+ compp1.setDescription("Composition-1: <30");
+ compp1.setExtraDescription("Xtra-Composition-1: <30");
+ db.create(compp1);
+
+ ComposedProduct compp2 = new ComposedProduct();
+ compp2.setName("Composition-2");
+ compp2.setExtraName("Xtra-Composition-2");
+ compp2.setDescription("Composition-2: <30");
+ compp2.setExtraDescription("Xtra-Composition-2: <30");
+ db.create(compp2);
+
+ db.commit();
+ db.close();
+ }
+
+ public void testComposeOffer() throws Exception {
+ Database db = _category.getDatabase();
+ db.setAutoStore(true);
+ db.begin();
+
+ Product1893 pd1 = new Product1893();
+ pd1.setName("Just product");
+ db.create(pd1);
+
+ Accommodation acc1 = new Accommodation();
+ acc1.setName("Comp-Accommodation-2");
+ acc1.setDescription("Comp-Accommodation-2: <30");
+ acc1.setBestSeason("Comp-Season-2");
+ db.create(acc1);
+
+ ComposedProduct compp1 = new ComposedProduct();
+ compp1.setName("Composition-3");
+ compp1.setExtraName("Xtra-Composition-3");
+ compp1.setDescription("Composition-3: <30");
+ compp1.setExtraDescription("Xtra-Composition-3: <30");
+ compp1.addSubProduct(pd1);
+ compp1.addSubProduct(acc1);
+ db.create(compp1);
+
+ db.commit();
+ db.close();
+ }
+}
Index: tests/ctf/jdo/tc9x/TestPolymorphismWithKeyGen.java
===================================================================
RCS file: tests/ctf/jdo/tc9x/TestPolymorphismWithKeyGen.java
diff -N tests/ctf/jdo/tc9x/TestPolymorphismWithKeyGen.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/ctf/jdo/tc9x/TestPolymorphismWithKeyGen.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2005 Werner Guttmann
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Id: TransactionContext.java,v 1.1 2005/06/20 12:00:59 wguttmn Exp $
+ *
+ */
+
+package ctf.jdo.tc9x;
+
+import harness.CastorTestCase;
+import harness.TestHarness;
+
+import jdo.JDOCategory;
+
+import org.exolab.castor.jdo.Database;
+import org.exolab.castor.jdo.ObjectNotFoundException;
+
+/**
+ * Tests that modification to read only objects are not persist in the
+ * database.
+ */
+public final class TestPolymorphismWithKeyGen extends CastorTestCase {
+
+ private JDOCategory _category;
+
+ /**
+ * Constructor
+ * @param category the test suite that this test case belongs
+ */
+ public TestPolymorphismWithKeyGen(final TestHarness category) {
+ super(category, "TC95", "Polymorphism tests with key generator");
+ _category = (JDOCategory) category;
+ }
+
+ /**
+ * Tests that modification to read only objects are not persist in the
+ * database.
+ */
+ public void runTest() throws Exception {
+ testCreateAndLoadLaptop();
+ }
+
+ public void testCreateAndLoadLaptop() throws Exception {
+ Database database = null;
+
+ database = _category.getDatabase();
+
+ database.begin();
+ ProductDetail detail = new ProductDetail();
+ detail.setId(10);
+ detail.setCategory("category 10");
+ detail.setLocation("location 10");
+ database.create(detail);
+ database.commit();
+
+ database.begin();
+ LaptopKeyGen laptop = new LaptopKeyGen();
+ laptop.setName("laptop 10");
+ laptop.setCpu("centrino");
+ laptop.setResolution("1600");
+ laptop.setWeight(2750);
+ laptop.setDetail((ProductDetail)
+ database.load(ProductDetail.class, new Integer (10)));
+ database.create(laptop);
+ database.commit();
+
+ int laptopId = laptop.getId();
+
+ database.begin();
+ laptop = (LaptopKeyGen)
+ database.load(LaptopKeyGen.class, new Integer(laptopId));
+ database.commit();
+
+ assertNotNull(laptop);
+ assertEquals("ctf.jdo.tc9x.LaptopKeyGen", laptop.getClass().getName());
+ assertEquals(laptopId, laptop.getId());
+ assertEquals("laptop 10", laptop.getName());
+
+ database.begin();
+ database.remove(database.load(LaptopKeyGen.class, new Integer(laptopId)));
+ database.commit();
+
+ database.begin();
+ try {
+ laptop = (LaptopKeyGen)
+ database.load(LaptopKeyGen.class, new Integer(laptopId));
+ fail("Laptop with id " + laptopId + " still exists.");
+ } catch (ObjectNotFoundException e) {
+ assertTrue("The object of type ctf.jdo.tc9x.Laptop with identity " + laptopId
+ + " was not found in persistent storage", true);
+ }
+
+ database.commit();
+ database.close();
+ }
+}
Index: tests/ctf/jdo/tc9x/TestPolymorphismWithUpdates.java
===================================================================
RCS file: tests/ctf/jdo/tc9x/TestPolymorphismWithUpdates.java
diff -N tests/ctf/jdo/tc9x/TestPolymorphismWithUpdates.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/ctf/jdo/tc9x/TestPolymorphismWithUpdates.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,290 @@
+/*
+ * Copyright 2005 Werner Guttmann
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Id: TransactionContext.java,v 1.1 2005/06/20 12:00:59 wguttmn Exp $
+ *
+ */
+package ctf.jdo.tc9x;
+
+import harness.CastorTestCase;
+import harness.TestHarness;
+import jdo.JDOCategory;
+
+import org.exolab.castor.jdo.Database;
+
+/**
+ * Tests that modification to read only objects are not persist in the
+ * database.
+ */
+public final class TestPolymorphismWithUpdates extends CastorTestCase {
+
+ private JDOCategory _category;
+
+ /**
+ * Constructor
+ * @param category the test suite that this test case belongs
+ */
+ public TestPolymorphismWithUpdates(final TestHarness category) {
+ super(category, "TC94", "Polymorphism tests");
+ _category = (JDOCategory) category;
+ }
+
+ /**
+ * Tests that modification to read only objects are not persist in the
+ * database.
+ */
+ public void runTest() throws Exception {
+ testLoadAndUpdateLaptop();
+ }
+
+ public void testLoadAndUpdateLaptop() throws Exception {
+ Database database = _category.getDatabase();
+
+ database.begin();
+ Laptop laptop = (Laptop) database.load(Laptop.class, new Integer(1));
+ database.commit();
+
+ assertNotNull(laptop);
+ assertEquals("ctf.jdo.tc9x.Laptop", laptop.getClass().getName());
+ assertEquals(1, laptop.getId());
+ assertEquals("laptop 1", laptop.getName());
+
+ laptop.setName("laptop 1x");
+
+ database.begin();
+ database.update(laptop);
+ database.commit();
+
+ database.begin();
+ laptop = (Laptop) database.load(Laptop.class, new Integer(1));
+ database.commit();
+
+ assertNotNull(laptop);
+ assertEquals("ctf.jdo.tc9x.Laptop", laptop.getClass().getName());
+ assertEquals(1, laptop.getId());
+ assertEquals("laptop 1x", laptop.getName());
+
+ laptop.setName("laptop 1");
+
+ database.begin();
+ database.update(laptop);
+ database.commit();
+
+ database.begin();
+ laptop = (Laptop) database.load(Laptop.class, new Integer(1));
+ database.commit();
+
+ assertNotNull(laptop);
+ assertEquals("ctf.jdo.tc9x.Laptop", laptop.getClass().getName());
+ assertEquals(1, laptop.getId());
+ assertEquals("laptop 1", laptop.getName());
+
+ database.close();
+ }
+
+ public void testLoadAndUpdateLaptopRollback() throws Exception {
+ Database database = _category.getDatabase();
+
+ database.begin();
+ Laptop laptop = (Laptop) database.load(Laptop.class, new Integer(1));
+ database.commit();
+
+ assertNotNull(laptop);
+ assertEquals("ctf.jdo.tc9x.Laptop", laptop.getClass().getName());
+ assertEquals(1, laptop.getId());
+ assertEquals("laptop 1", laptop.getName());
+
+ laptop.setName("laptop 1x");
+
+ database.begin();
+ database.update(laptop);
+ database.commit();
+
+ database.begin();
+ laptop = (Laptop) database.load(Laptop.class, new Integer(1));
+ database.commit();
+
+ assertNotNull(laptop);
+ assertEquals("ctf.jdo.tc9x.Laptop", laptop.getClass().getName());
+ assertEquals(1, laptop.getId());
+ assertEquals("laptop 1x", laptop.getName());
+
+ laptop.setName("laptop 1");
+
+ database.begin();
+ database.update(laptop);
+ database.rollback();
+
+ database.begin();
+ laptop = (Laptop) database.load(Laptop.class, new Integer(1));
+ database.commit();
+
+ assertNotNull(laptop);
+ assertEquals("ctf.jdo.tc9x.Laptop", laptop.getClass().getName());
+ assertEquals(1, laptop.getId());
+ assertEquals("laptop 1x", laptop.getName());
+
+ laptop.setName("laptop 1");
+
+ database.begin();
+ database.update(laptop);
+ database.commit();
+
+ database.begin();
+ laptop = (Laptop) database.load(Laptop.class, new Integer(1));
+ database.commit();
+
+ assertNotNull(laptop);
+ assertEquals("ctf.jdo.tc9x.Laptop", laptop.getClass().getName());
+ assertEquals(1, laptop.getId());
+ assertEquals("laptop 1", laptop.getName());
+ database.close();
+ }
+
+ public void testLoadAndUpdateCar() throws Exception {
+ Database database = _category.getDatabase();
+
+ database.begin();
+ Truck truck = (Truck) database.load(Truck.class, new Integer(5));
+ database.commit();
+
+ assertNotNull(truck);
+ assertEquals("ctf.jdo.tc9x.Truck", truck.getClass().getName());
+ assertEquals(5, truck.getId());
+ assertEquals("truck 5", truck.getName());
+
+ truck.setName("truck 5t");
+
+ database.begin();
+ database.update(truck);
+ database.commit();
+
+ database.begin();
+ truck = (Truck) database.load(Truck.class, new Integer(5));
+ database.commit();
+
+ assertNotNull(truck);
+ assertEquals("ctf.jdo.tc9x.Truck", truck.getClass().getName());
+ assertEquals(5, truck.getId());
+ assertEquals("truck 5t", truck.getName());
+
+ truck.setName("truck 5");
+
+ database.begin();
+ database.update(truck);
+ database.commit();
+
+ database.begin();
+ truck = (Truck) database.load(Truck.class, new Integer(5));
+ database.commit();
+
+ assertNotNull(truck);
+ assertEquals("ctf.jdo.tc9x.Truck", truck.getClass().getName());
+ assertEquals(5, truck.getId());
+ assertEquals("truck 5", truck.getName());
+
+ database.close();
+ }
+
+ public void testLoadAndUpdateTruck() throws Exception {
+ Database database = _category.getDatabase();
+
+ database.begin();
+ Car car = (Car) database.load(Car.class, new Integer(5));
+ database.commit();
+
+ assertNotNull(car);
+ assertEquals("ctf.jdo.tc9x.Car", car.getClass().getName());
+ assertEquals(5, car.getId());
+ assertEquals("truck 5", car.getName());
+
+ car.setName("truck 5t");
+
+ database.begin();
+ database.update(car);
+ database.commit();
+
+ database.begin();
+ car = (Car) database.load(Car.class, new Integer(5));
+ database.commit();
+
+ assertNotNull(car);
+ assertEquals("ctf.jdo.tc9x.Car", car.getClass().getName());
+ assertEquals(5, car.getId());
+ assertEquals("truck 5t", car.getName());
+
+ car.setName("truck 5");
+
+ database.begin();
+ database.update(car);
+ database.commit();
+
+ database.begin();
+ car = (Car) database.load(Car.class, new Integer(5));
+ database.commit();
+
+ assertNotNull(car);
+ assertEquals("ctf.jdo.tc9x.Car", car.getClass().getName());
+ assertEquals(5, car.getId());
+ assertEquals("truck 5", car.getName());
+
+ database.close();
+ }
+
+ public void testLoadAndUpdateProduct() throws Exception {
+ Database database = _category.getDatabase();
+
+ database.begin();
+ Product product = (Product) database.load(Product.class, new Integer(5));
+ database.commit();
+
+ assertNotNull(product);
+ assertEquals("ctf.jdo.tc9x.Product", product.getClass().getName());
+ assertEquals(5, product.getId());
+ assertEquals("truck 5", product.getName());
+
+ product.setName("truck 5t");
+
+ database.begin();
+ database.update(product);
+ database.commit();
+
+ database.begin();
+ product = (Product) database.load(Product.class, new Integer(5));
+ database.commit();
+
+ assertNotNull(product);
+ assertEquals("ctf.jdo.tc9x.Product", product.getClass().getName());
+ assertEquals(5, product.getId());
+ assertEquals("truck 5t", product.getName());
+
+ product.setName("truck 5");
+
+ database.begin();
+ database.update(product);
+ database.commit();
+
+ database.begin();
+ product = (Product) database.load(Product.class, new Integer(5));
+ database.commit();
+
+ assertNotNull(product);
+ assertEquals("ctf.jdo.tc9x.Product", product.getClass().getName());
+ assertEquals(5, product.getId());
+ assertEquals("truck 5", product.getName());
+
+ database.close();
+ }
+}
Index: tests/ctf/jdo/tc9x/Truck.java
===================================================================
RCS file: tests/ctf/jdo/tc9x/Truck.java
diff -N tests/ctf/jdo/tc9x/Truck.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/ctf/jdo/tc9x/Truck.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2005 Werner Guttmann
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Id: TransactionContext.java,v 1.1 2005/06/20 12:00:59 wguttmn Exp $
+ *
+ */
+package ctf.jdo.tc9x;
+
+public final class Truck extends Car {
+ private int _maxWeight;
+
+ public int getMaxWeight() { return _maxWeight; }
+ public void setMaxWeight(final int maxWeight) { _maxWeight = maxWeight; }
+}
Index: tests/ctf/jdo/tc9x/TruckKeyGen.java
===================================================================
RCS file: tests/ctf/jdo/tc9x/TruckKeyGen.java
diff -N tests/ctf/jdo/tc9x/TruckKeyGen.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/ctf/jdo/tc9x/TruckKeyGen.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2005 Werner Guttmann
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Id: TransactionContext.java,v 1.1 2005/06/20 12:00:59 wguttmn Exp $
+ *
+ */
+package ctf.jdo.tc9x;
+
+public final class TruckKeyGen extends CarKeyGen {
+ private int _maxWeight;
+
+ public int getMaxWeight() { return _maxWeight; }
+ public void setMaxWeight(final int maxWeight) { _maxWeight = maxWeight; }
+}
Index: tests/ctf/jdo/tc9x/mapping.xml
===================================================================
RCS file: tests/ctf/jdo/tc9x/mapping.xml
diff -N tests/ctf/jdo/tc9x/mapping.xml
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/ctf/jdo/tc9x/mapping.xml 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,414 @@
+
+
+
+
+ Product definition
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Computer definition, extends generic product
+
+
+
+
+
+
+
+
+
+
+ Laptop definition, extends generic computer
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Server definition, extends generic computer
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Car definition, extends generic product
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Truck definition, extends generic car
+
+
+
+
+
+
+
+
+
+
+ ProductMulti definition
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ComputerMulti definition, extends generic product
+
+
+
+
+
+
+
+
+
+
+
+
+
+ LaptopMulti definition, extends generic computer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ServerMulti definition, extends generic computer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Owner definition
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Product detail definition
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Order definition
+
+
+
+
+
+
+
+
+
+
+
+
+
+ M definition
+
+
+
+
+
+
+
+
+
+
+
+
+
+ N definition
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Product definition
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Computer definition, extends generic product
+
+
+
+
+
+
+
+
+
+
+
+ Laptop definition, extends generic computer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Server definition, extends generic computer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Car definition, extends generic product
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Truck definition, extends generic car
+
+
+
+
+
+
+
+
+
+
Index: tests/jdo/TestLimit.java
===================================================================
RCS file: tests/jdo/TestLimit.java
diff -N tests/jdo/TestLimit.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/jdo/TestLimit.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,125 @@
+/**
+ * Redistribution and use of this software and associated documentation
+ * ("Software"), with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain copyright
+ * statements and notices. Redistributions must also contain a
+ * copy of this document.
+ *
+ * 2. Redistributions in binary form must reproduce the
+ * above copyright notice, this list of conditions and the
+ * following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. The name "Exolab" must not be used to endorse or promote
+ * products derived from this Software without prior written
+ * permission of Intalio, Inc. For written permission,
+ * please contact info@exolab.org.
+ *
+ * 4. Products derived from this Software may not be called "Exolab"
+ * nor may "Exolab" appear in their names without prior written
+ * permission of Intalio, Inc. Exolab is a registered
+ * trademark of Intalio, Inc.
+ *
+ * 5. Due credit should be given to the Exolab Project
+ * (http://www.exolab.org/).
+ *
+ * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
+ * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Copyright 1999 (C) Intalio, Inc. All Rights Reserved.
+ *
+ * $Id: TestObject.java,v 1.2 2005/05/11 17:18:50 rjoachim Exp $
+ */
+
+
+package jdo;
+
+
+/**
+ * Test object mapping to test_table used to conduct all the tests.
+ */
+public class TestLimit
+{
+
+
+ private int _id;
+
+
+ private String _value1;
+
+
+ private String _value2;
+
+
+ public static final int DefaultId = 3;
+
+
+ public static final String DefaultValue1 = "one";
+
+
+ public static final String DefaultValue2 = "two";
+
+
+ public TestLimit()
+ {
+ _id = DefaultId;
+ _value1 = DefaultValue1;
+ _value2 = DefaultValue2;
+ }
+
+
+ public void setId( int id )
+ {
+ _id = id;
+ }
+
+
+ public int getId()
+ {
+ return _id;
+ }
+
+
+ public void setValue1( String value1 )
+ {
+ _value1 = value1;
+ }
+
+
+ public String getValue1()
+ {
+ return _value1;
+ }
+
+
+ public void setValue2( String value2 )
+ {
+ _value2 = value2;
+ }
+
+
+ public String getValue2()
+ {
+ return _value2;
+ }
+
+
+ public String toString()
+ {
+ return _id + " / " + _value1 + " / " + _value2;
+ }
+
+
+}
Index: tests/jdo/TestLimitWithOffsetExtend.java
===================================================================
RCS file: tests/jdo/TestLimitWithOffsetExtend.java
diff -N tests/jdo/TestLimitWithOffsetExtend.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/jdo/TestLimitWithOffsetExtend.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,123 @@
+/**
+ * Redistribution and use of this software and associated documentation
+ * ("Software"), with or without modification, are permitted provided
+ * that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain copyright
+ * statements and notices. Redistributions must also contain a
+ * copy of this document.
+ *
+ * 2. Redistributions in binary form must reproduce the
+ * above copyright notice, this list of conditions and the
+ * following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. The name "Exolab" must not be used to endorse or promote
+ * products derived from this Software without prior written
+ * permission of Intalio, Inc. For written permission,
+ * please contact info@exolab.org.
+ *
+ * 4. Products derived from this Software may not be called "Exolab"
+ * nor may "Exolab" appear in their names without prior written
+ * permission of Intalio, Inc. Exolab is a registered
+ * trademark of Intalio, Inc.
+ *
+ * 5. Due credit should be given to the Exolab Project
+ * (http://www.exolab.org/).
+ *
+ * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
+ * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Copyright 1999 (C) Intalio, Inc. All Rights Reserved.
+ *
+ * $Id: TestLimitWithOffsetClause.java,v 1.1 2004/10/08 09:00:15 wguttmann Exp $
+ */
+
+
+package jdo;
+
+import org.exolab.castor.jdo.Database;
+import org.exolab.castor.jdo.QueryResults;
+import org.exolab.castor.jdo.OQLQuery;
+import org.exolab.castor.jdo.PersistenceException;
+import org.exolab.castor.jdo.oql.OQLSyntaxException;
+
+import harness.TestHarness;
+
+public class TestLimitWithOffsetExtend extends TestLimitClause
+{
+ private static final int OFFSET = 2;
+
+ /**
+ * Constructor
+ *
+ * @param category The test suite for these tests
+ */
+ public TestLimitWithOffsetExtend( TestHarness category )
+ {
+ super( category, "TC62b", "Test limit clause with offset at extended object" );
+ _category = (JDOCategory) category;
+ }
+
+ public void testLimitWithOffset()
+ throws PersistenceException
+ {
+ TestObject testObject = null;
+
+ Database db = _category.getDatabase();
+
+ db.begin();
+
+ OQLQuery query = db.getOQLQuery("select t from jdo.TestObject t order by id limit $1 offset $2");
+
+ query.bind(LIMIT);
+ query.bind(OFFSET);
+
+ QueryResults results = query.execute();
+ assertNotNull (results);
+ /*size() not available using an Oracle DB
+ assertEquals (LIMIT, results.size()); */
+ for (int i = 1 + OFFSET; i <= OFFSET+LIMIT; i++) {
+ testObject = (TestObject) results.next();
+ assertEquals(i, testObject.getId());
+ }
+ assertTrue(!results.hasMore());
+
+ db.commit();
+ }
+
+ public void testOffsetWithoutLimit()
+ throws PersistenceException
+ {
+
+ Database db = _category.getDatabase();
+
+ db.begin();
+ try {
+ db.getOQLQuery("select t from jdo.TestObject t offset $1");
+ } catch (OQLSyntaxException e) {
+ assertEquals ("org.exolab.castor.jdo.oql.OQLSyntaxException", e.getClass().getName());
+ return;
+ }
+ finally {
+ db.commit();
+ }
+ }
+
+ public void runTest() throws Exception {
+ super.runTest();
+ testLimitWithOffset();
+ testOffsetWithoutLimit();
+ }
+
+}
Index: tests/ptf/jdo/rel1toN/results-tx-poly.txt
===================================================================
RCS file: tests/ptf/jdo/rel1toN/results-tx-poly.txt
diff -N tests/ptf/jdo/rel1toN/results-tx-poly.txt
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/ptf/jdo/rel1toN/results-tx-poly.txt 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,280 @@
+0.9.7 with TransactionContext refactoring (CASTOR-1085)
+and polymorphism support (CASTOR-1018)
+=======================================================
+(uses own org.castor.util.IdentityMap and IdentitySet)
+
+TestCreate (5000)
+
+Created 3 state objects in 94ms.
+Created 14 department objects in 172ms.
+Created 5 reason objects in 78ms.
+Created 8 supplier objects in 110ms.
+Created 166 type objects in 375ms.
+Created 983 equipment objects in 1656ms.
+Created 5000 service objects in 6312ms.
+
+
+TestLoadBiNto1 (5000)
+
+ begin result iterate commit close
+ReadWriteEmpty 47 94 13.953 188 0
+ReadWriteCached 15 94 2.422 172 0
+ReadWriteOidEmpty 15 32 11.500 156 0
+ReadWriteOidCached 15 63 500 156 0
+ReadOnlyEmpty 16 94 13.187 0 0
+ReadOnlyCached 31 94 2.265 0 0
+ReadOnlyOidEmpty 16 47 11.375 0 0
+ReadOnlyOidCached 0 47 500 0 0
+ReadOnlyOidOnly 0 47 187 0 0
+
+
+TestLoadUniNto1 (5000)
+
+ begin result iterate commit close
+ReadWriteEmpty 16 94 3.968 110 0
+ReadWriteCached 0 94 2.485 109 0
+ReadWriteOidEmpty 16 46 7.860 125 0
+ReadWriteOidCached 15 32 453 140 0
+ReadOnlyEmpty 16 94 3.922 0 0
+ReadOnlyCached 0 78 2.469 0 0
+ReadOnlyOidEmpty 0 47 7.828 0 0
+ReadOnlyOidCached 0 47 469 0 0
+ReadOnlyOidOnly 15 47 203 0 0
+
+
+TestLoadBi1toN (5000)
+
+ begin result iterate commit close
+ReadWriteEmpty 16 0 11.375 141 0
+ReadWriteCached 15 16 250 172 0
+ReadWriteOidEmpty 31 0 11.016 125 0
+ReadWriteOidCached 15 0 407 140 0
+ReadOnlyEmpty 16 0 10.969 0 0
+ReadOnlyCached 15 16 422 0 0
+ReadOnlyOidEmpty 15 0 10.985 0 0
+ReadOnlyOidCached 15 0 266 0 0
+ReadOnlyOidOnly 16 0 0 0 0
+
+
+TestLoadLazy1toN (5000)
+
+ begin result iterate commit close
+ReadWriteEmpty 16 0 11.078 156 0
+ReadWriteCached 16 0 265 141 0
+ReadWriteOidEmpty 16 0 11.000 140 0
+ReadWriteOidCached 0 16 266 140 0
+ReadOnlyEmpty 16 15 11.000 157 0
+ReadOnlyCached 0 15 250 141 0
+ReadOnlyOidEmpty 31 0 11.250 141 0
+ReadOnlyOidCached 15 0 250 141 0
+ReadOnlyOidOnly 16 0 0 0 0
+
+
+TestLoadUni1toN (5000)
+
+ begin result iterate commit close
+ReadWriteEmpty 15 0 13.469 109 0
+ReadWriteCached 16 0 13.125 125 0
+ReadWriteOidEmpty 16 0 11.890 125 0
+ReadWriteOidCached 16 16 4.671 141 0
+ReadOnlyEmpty 0 16 13.265 0 0
+ReadOnlyCached 0 16 13.109 0 0
+ReadOnlyOidEmpty 16 0 11.546 0 0
+ReadOnlyOidCached 16 16 4.375 0 0
+ReadOnlyOidOnly 15 0 0 0 0
+
+
+TestRemove (5000)
+
+Removed 5000 service objects in 4562ms.
+Removed 983 equipment objects in 954ms.
+Removed 166 type objects in 156ms.
+Removed 8 supplier objects in 47ms.
+Removed 5 reason objects in 62ms.
+Removed 14 department objects in 47ms.
+Removed 3 state objects in 31ms.
+
+
+
+TestCreate (10000)
+
+Created 7 state objects in 62ms.
+Created 29 department objects in 157ms.
+Created 11 reason objects in 62ms.
+Created 17 supplier objects in 78ms.
+Created 333 type objects in 703ms.
+Created 1967 equipment objects in 3094ms.
+Created 10000 service objects in 12594ms.
+
+
+TestLoadBiNto1 (10000)
+
+ begin result iterate commit close
+ReadWriteEmpty 31 187 33.844 313 0
+ReadWriteCached 15 172 4.500 281 0
+ReadWriteOidEmpty 32 78 29.547 312 0
+ReadWriteOidCached 0 78 1.062 625 0
+ReadOnlyEmpty 32 171 32.969 0 0
+ReadOnlyCached 0 172 4.515 0 0
+ReadOnlyOidEmpty 32 78 29.390 0 0
+ReadOnlyOidCached 16 78 1.063 0 0
+ReadOnlyOidOnly 31 62 407 0 0
+
+
+TestLoadUniNto1 (10000)
+
+ begin result iterate commit close
+ReadWriteEmpty 16 344 7.640 219 0
+ReadWriteCached 0 187 5.016 234 0
+ReadWriteOidEmpty 16 78 16.062 266 0
+ReadWriteOidCached 16 78 937 281 0
+ReadOnlyEmpty 16 172 7.875 0 0
+ReadOnlyCached 16 171 5.110 0 0
+ReadOnlyOidEmpty 16 63 16.015 0 0
+ReadOnlyOidCached 16 94 1.015 0 0
+ReadOnlyOidOnly 0 62 641 0 0
+
+
+TestLoadBi1toN (10000)
+
+ begin result iterate commit close
+ReadWriteEmpty 16 15 28.297 281 0
+ReadWriteCached 16 0 766 312 0
+ReadWriteOidEmpty 16 15 28.250 282 0
+ReadWriteOidCached 0 16 703 297 0
+ReadOnlyEmpty 16 0 28.328 0 0
+ReadOnlyCached 0 16 765 0 0
+ReadOnlyOidEmpty 16 16 28.625 0 0
+ReadOnlyOidCached 0 15 766 0 0
+ReadOnlyOidOnly 16 0 0 0 0
+
+
+TestLoadLazy1toN (10000)
+
+ begin result iterate commit close
+ReadWriteEmpty 15 16 28.750 359 0
+ReadWriteCached 0 15 875 313 0
+ReadWriteOidEmpty 31 0 30.297 297 0
+ReadWriteOidCached 16 0 875 312 0
+ReadOnlyEmpty 16 0 28.234 313 0
+ReadOnlyCached 15 16 547 343 0
+ReadOnlyOidEmpty 16 0 28.297 297 0
+ReadOnlyOidCached 15 0 500 313 0
+ReadOnlyOidOnly 0 16 0 0 0
+
+
+TestLoadUni1toN (10000)
+
+ begin result iterate commit close
+ReadWriteEmpty 15 0 43.328 235 0
+ReadWriteCached 15 0 42.282 234 0
+ReadWriteOidEmpty 15 0 29.063 250 0
+ReadWriteOidCached 15 0 15.328 282 0
+ReadOnlyEmpty 15 16 42.594 0 0
+ReadOnlyCached 0 16 42.437 0 0
+ReadOnlyOidEmpty 16 47 29.312 0 0
+ReadOnlyOidCached 16 0 15.047 0 0
+ReadOnlyOidOnly 31 0 0 0 0
+
+
+TestRemove (10000)
+
+Removed 10000 service objects in 8640ms.
+Removed 1967 equipment objects in 1469ms.
+Removed 333 type objects in 469ms.
+Removed 17 supplier objects in 46ms.
+Removed 11 reason objects in 47ms.
+Removed 29 department objects in 63ms.
+Removed 7 state objects in 47ms.
+
+
+
+TestCreate (20000)
+
+Created 14 state objects in 219ms.
+Created 58 department objects in 234ms.
+Created 22 reason objects in 141ms.
+Created 34 supplier objects in 156ms.
+Created 666 type objects in 1047ms.
+Created 3934 equipment objects in 5047ms.
+Created 20000 service objects in 23625ms.
+
+
+TestLoadBiNto1 (20000)
+
+ begin result iterate commit close
+ReadWriteEmpty 47 359 94.313 625 0
+ReadWriteCached 0 360 9.046 547 0
+ReadWriteOidEmpty 31 141 86.359 594 0
+ReadWriteOidCached 0 141 2.593 594 0
+ReadOnlyEmpty 31 328 90.891 0 0
+ReadOnlyCached 0 343 8.985 0 0
+ReadOnlyOidEmpty 31 141 84.922 0 0
+ReadOnlyOidCached 0 141 2.125 0 0
+ReadOnlyOidOnly 0 141 1.094 0 0
+
+
+TestLoadUniNto1 (20000)
+
+ begin result iterate commit close
+ReadWriteEmpty 15 344 15.047 469 0
+ReadWriteCached 0 359 10.000 469 0
+ReadWriteOidEmpty 16 140 30.469 500 0
+ReadWriteOidCached 16 125 2.484 531 0
+ReadOnlyEmpty 47 328 15.391 0 0
+ReadOnlyCached 0 375 10.062 0 0
+ReadOnlyOidEmpty 32 125 30.968 0 0
+ReadOnlyOidCached 0 157 2.375 0 0
+ReadOnlyOidOnly 31 140 782 0 0
+
+TestLoadBi1toN (20000)
+
+ begin result iterate commit close
+ReadWriteEmpty 16 47 83.937 594 0
+ReadWriteCached 16 0 1.031 594 0
+ReadWriteOidEmpty 47 0 84.062 563 0
+ReadWriteOidCached 0 31 984 610 0
+ReadOnlyEmpty 31 0 82.844 0 0
+ReadOnlyCached 0 15 1.047 0 0
+ReadOnlyOidEmpty 31 0 82.922 0 0
+ReadOnlyOidCached 16 0 1.047 0 0
+ReadOnlyOidOnly 0 0 0 0 0
+
+
+TestLoadLazy1toN (20000)
+
+ begin result iterate commit close
+ReadWriteEmpty 0 16 83.218 703 0
+ReadWriteCached 0 16 2.047 1.250 0
+ReadWriteOidEmpty 16 15 83.594 656 0
+ReadWriteOidCached 16 31 2.016 687 0
+ReadOnlyEmpty 32 0 83.093 672 0
+ReadOnlyCached 16 0 2.031 703 0
+ReadOnlyOidEmpty 32 0 82.687 672 0
+ReadOnlyOidCached 0 16 2.062 688 0
+ReadOnlyOidOnly 0 0 16 0 0
+
+
+TestLoadUni1toN (20000)
+
+ begin result iterate commit close
+ReadWriteEmpty 15 0 159.719 469 0
+ReadWriteCached 16 31 158.109 453 0
+ReadWriteOidEmpty 31 0 84.422 500 0
+ReadWriteOidCached 16 0 56.453 1.766 0
+ReadOnlyEmpty 31 0 158.953 0 0
+ReadOnlyCached 16 0 158.437 0 0
+ReadOnlyOidEmpty 31 0 84.125 0 0
+ReadOnlyOidCached 16 0 56.531 0 0
+ReadOnlyOidOnly 0 16 0 0 0
+
+
+TestRemove (20000)
+
+Removed 20000 service objects in 116625ms.
+Removed 3934 equipment objects in 3171ms.
+Removed 666 type objects in 844ms.
+Removed 34 supplier objects in 47ms.
+Removed 22 reason objects in 47ms.
+Removed 58 department objects in 62ms.
+Removed 14 state objects in 47ms.