use of org.eclipse.persistence.platform.database.oracle.plsql.PLSQLCollection in project eclipselink by eclipse-ee4j.
the class PLSQLProject method buildCityListOutQuery.
protected DatabaseQuery buildCityListOutQuery() {
PLSQLCollection collection = new PLSQLCollection();
collection.setTypeName("PLSQL_P.PLSQL_CITY_LIST");
collection.setCompatibleType("PLSQL_P_PLSQL_CITY_LIST");
collection.setNestedType(JDBCTypes.VARCHAR_TYPE);
PLSQLStoredProcedureCall call = new PLSQLStoredProcedureCall();
call.setProcedureName("PLSQL_P.PLSQL_CITY_LIST_OUT");
call.addNamedOutputArgument("P_CITY_LIST", collection);
call.addNamedOutputArgument("P_CITY", JDBCTypes.VARCHAR_TYPE);
DataReadQuery query = new DataReadQuery();
query.setCall(call);
return query;
}
use of org.eclipse.persistence.platform.database.oracle.plsql.PLSQLCollection in project eclipselink by eclipse-ee4j.
the class PLSQLProject method buildAddressListInQuery.
protected DatabaseQuery buildAddressListInQuery() {
PLSQLrecord record = buildAddressRecord();
PLSQLCollection collection = new PLSQLCollection();
collection.setTypeName("PLSQL_P.PLSQL_ADDRESS_LIST");
collection.setCompatibleType("PLSQL_P_PLSQL_ADDRESS_LIST");
collection.setNestedType(record);
PLSQLStoredProcedureCall call = new PLSQLStoredProcedureCall();
call.setProcedureName("PLSQL_P.PLSQL_ADDRESS_LIST_IN");
call.addNamedArgument("P_ADDRESS_LIST", collection);
call.addNamedArgument("P_CITY", JDBCTypes.VARCHAR_TYPE);
DataModifyQuery query = new DataModifyQuery();
query.addArgument("P_ADDRESS_LIST", java.sql.Array.class);
query.addArgument("P_CITY", String.class);
query.setCall(call);
return query;
}
use of org.eclipse.persistence.platform.database.oracle.plsql.PLSQLCollection in project eclipselink by eclipse-ee4j.
the class PLSQLcollectionTestSuite method setUpProject.
@BeforeClass
public static void setUpProject() {
final String ddlCreateProp = System.getProperty(DATABASE_DDL_CREATE_KEY, DEFAULT_DATABASE_DDL_CREATE);
if ("true".equalsIgnoreCase(ddlCreateProp)) {
ddlCreate = true;
}
final String ddlDropProp = System.getProperty(DATABASE_DDL_DROP_KEY, DEFAULT_DATABASE_DDL_DROP);
if ("true".equalsIgnoreCase(ddlDropProp)) {
ddlDrop = true;
}
final String ddlDebugProp = System.getProperty(DATABASE_DDL_DEBUG_KEY, DEFAULT_DATABASE_DDL_DEBUG);
if ("true".equalsIgnoreCase(ddlDebugProp)) {
ddlDebug = true;
}
username = System.getProperty(DATABASE_USERNAME_KEY);
if (username == null) {
fail("error retrieving database username");
}
password = System.getProperty(DATABASE_PASSWORD_KEY);
if (password == null) {
fail("error retrieving database password");
}
url = System.getProperty(DATABASE_URL_KEY);
if (url == null) {
fail("error retrieving database url");
}
project = new Project();
project.setName("PLSQLcollectionTestSuite");
ObjectRelationalDataTypeDescriptor t1Descriptor = new ObjectRelationalDataTypeDescriptor();
t1Descriptor.setAlias("T1");
t1Descriptor.setJavaClassName("org.eclipse.persistence.testing.tests.plsqlcollection.T1");
t1Descriptor.descriptorIsAggregate();
t1Descriptor.getQueryManager();
project.addDescriptor(t1Descriptor);
PLSQLCollection simplArray = new PLSQLCollection();
simplArray.setTypeName("SOMEPACKAGE.TBL1");
simplArray.setCompatibleType("SOMEPACKAGE_TBL1");
simplArray.setNestedType(JDBCTypes.VARCHAR_TYPE);
PLSQLStoredProcedureCall call = new PLSQLStoredProcedureCall();
call.setProcedureName("SOMEPACKAGE.P1");
call.addNamedArgument("SIMPLARRAY", simplArray);
call.addNamedArgument("FOO", JDBCTypes.VARCHAR_TYPE, 10);
DataModifyQuery query = new DataModifyQuery();
query.addArgument("SIMPLARRAY", Array.class);
query.addArgument("FOO", String.class);
query.setCall(call);
t1Descriptor.getQueryManager().addQuery(QUERY_NAME, query);
if (ddlCreate) {
try {
AllTests.runDdl(CREATE_DDL, ddlDebug);
} catch (Exception e) {
// e.printStackTrace();
}
}
}
use of org.eclipse.persistence.platform.database.oracle.plsql.PLSQLCollection in project eclipselink by eclipse-ee4j.
the class ObjectPersistenceRuntimeXMLProject_11_1_1 method buildPLSQLCollectionDescriptor.
protected ClassDescriptor buildPLSQLCollectionDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClass(PLSQLCollection.class);
XMLDirectMapping typeNameMapping = new XMLDirectMapping();
typeNameMapping.setAttributeName("typeName");
typeNameMapping.setXPath(getPrimaryNamespaceXPath() + "type-name/text()");
descriptor.addMapping(typeNameMapping);
XMLDirectMapping compatibleTypeMapping = new XMLDirectMapping();
compatibleTypeMapping.setAttributeName("compatibleType");
compatibleTypeMapping.setXPath(getPrimaryNamespaceXPath() + "compatible-type/text()");
descriptor.addMapping(compatibleTypeMapping);
XMLDirectMapping javaTypeMapping = new XMLDirectMapping();
javaTypeMapping.setAttributeName("javaType");
javaTypeMapping.setXPath(getPrimaryNamespaceXPath() + "java-type/text()");
descriptor.addMapping(javaTypeMapping);
XMLCompositeObjectMapping databaseTypeMapping = new XMLCompositeObjectMapping();
databaseTypeMapping.setAttributeName("databaseTypeWrapper");
databaseTypeMapping.setAttributeAccessor(new AttributeAccessor() {
@Override
public Object getAttributeValueFromObject(Object object) {
PLSQLCollection collection = (PLSQLCollection) object;
DatabaseType type = collection.getNestedType();
return wrapType(type);
}
@Override
public void setAttributeValueInObject(Object object, Object value) {
PLSQLCollection collection = (PLSQLCollection) object;
DatabaseTypeWrapper type = (DatabaseTypeWrapper) value;
collection.setNestedType(type.getWrappedType());
}
});
databaseTypeMapping.setReferenceClass(DatabaseTypeWrapper.class);
databaseTypeMapping.setXPath("nested-type");
descriptor.addMapping(databaseTypeMapping);
XMLDirectMapping isNestedTableMapping = new XMLDirectMapping();
isNestedTableMapping.setAttributeName("isNestedTable");
isNestedTableMapping.setXPath("@is-nested-table");
isNestedTableMapping.setNullValue(Boolean.FALSE);
descriptor.addMapping(isNestedTableMapping);
return descriptor;
}
use of org.eclipse.persistence.platform.database.oracle.plsql.PLSQLCollection in project eclipselink by eclipse-ee4j.
the class PLSQLTableMetadata method process.
/**
* INTERNAL:
* Build a runtime record type from the meta-data.
*/
@Override
public PLSQLCollection process() {
PLSQLCollection table = new PLSQLCollection();
super.process(table);
table.setIsNestedTable(isNestedTable());
table.setNestedType(getDatabaseTypeEnum(getNestedType()));
return table;
}
Aggregations