Search in sources :

Example 1 with StoredProcedureDefinition

use of org.eclipse.persistence.tools.schemaframework.StoredProcedureDefinition in project eclipselink by eclipse-ee4j.

the class EmployeePopulator method buildOracleStoredProcedureReadInOut.

public StoredProcedureDefinition buildOracleStoredProcedureReadInOut(DatabaseSession session) {
    StoredProcedureDefinition proc = new StoredProcedureDefinition();
    proc.setName("SProc_Read_InOut");
    proc.addInOutputArgument("address_id_v", Long.class);
    proc.addOutputArgument("street_v", String.class);
    String statement = null;
    if (session.getPlatform().isSQLServer() || session.getPlatform().isSybase()) {
        // 260263: SQLServer 2005/2008 requires parameter matching in the select clause for stored procedures
        statement = "SELECT @address_id_v=ADDRESS_ID, @street_v=STREET from MBR1_ADDRESS where (ADDRESS_ID = @address_id_v)";
    } else {
        statement = "SELECT ADDRESS_ID, STREET into address_id_v, street_v from MBR1_ADDRESS where (ADDRESS_ID = address_id_v)";
    }
    proc.addStatement(statement);
    return proc;
}
Also used : StoredProcedureDefinition(org.eclipse.persistence.tools.schemaframework.StoredProcedureDefinition)

Example 2 with StoredProcedureDefinition

use of org.eclipse.persistence.tools.schemaframework.StoredProcedureDefinition in project eclipselink by eclipse-ee4j.

the class EmployeePopulator method buildOracleStoredProcedureReadFromAddress.

public StoredProcedureDefinition buildOracleStoredProcedureReadFromAddress(DatabaseSession session) {
    StoredProcedureDefinition proc = new StoredProcedureDefinition();
    proc.setName("SProc_Read_BR1_Address");
    proc.addInOutputArgument("address_id_v", Integer.class);
    proc.addOutputArgument("street_v", String.class);
    proc.addOutputArgument("city_v", String.class);
    proc.addOutputArgument("country_v", String.class);
    proc.addOutputArgument("province_v", String.class);
    proc.addOutputArgument("p_code_v", String.class);
    String statement = null;
    if (session.getPlatform().isSQLServer() || session.getPlatform().isSybase()) {
        // 260263: SQLServer 2005/2008 requires parameter matching in the select clause for stored procedures
        statement = "SELECT @street_v=STREET, @city_v=CITY, @country_v=COUNTRY, @province_v=PROVINCE, @p_code_v=P_CODE FROM MBR1_ADDRESS WHERE ADDRESS_ID = @address_id_v";
    } else {
        statement = "SELECT STREET, CITY, COUNTRY, PROVINCE, P_CODE INTO street_v, city_v, country_v, province_v, p_code_v FROM MBR1_ADDRESS WHERE (ADDRESS_ID = address_id_v)";
    }
    proc.addStatement(statement);
    return proc;
}
Also used : StoredProcedureDefinition(org.eclipse.persistence.tools.schemaframework.StoredProcedureDefinition)

Example 3 with StoredProcedureDefinition

use of org.eclipse.persistence.tools.schemaframework.StoredProcedureDefinition in project eclipselink by eclipse-ee4j.

the class EmployeePopulator method buildOracleStoredProcedureReadInOut.

public StoredProcedureDefinition buildOracleStoredProcedureReadInOut(DatabaseSession session) {
    StoredProcedureDefinition proc = new StoredProcedureDefinition();
    proc.setName("SProc_Read_InOut");
    proc.addInOutputArgument("address_id_v", Long.class);
    proc.addOutputArgument("street_v", String.class);
    String statement = null;
    if (session.getPlatform().isSQLServer() || session.getPlatform().isSybase()) {
        // 260263: SQLServer 2005/2008 requires parameter matching in the select clause for stored procedures
        statement = "SELECT @address_id_v=ADDRESS_ID, @street_v=STREET from CMP3_ADDRESS where (ADDRESS_ID = @address_id_v)";
    } else {
        statement = "SELECT ADDRESS_ID, STREET into address_id_v, street_v from CMP3_ADDRESS where (ADDRESS_ID = address_id_v)";
    }
    proc.addStatement(statement);
    return proc;
}
Also used : StoredProcedureDefinition(org.eclipse.persistence.tools.schemaframework.StoredProcedureDefinition)

Example 4 with StoredProcedureDefinition

use of org.eclipse.persistence.tools.schemaframework.StoredProcedureDefinition in project eclipselink by eclipse-ee4j.

the class EmployeePopulator method buildOracleStoredProcedureReadFromAddress.

public StoredProcedureDefinition buildOracleStoredProcedureReadFromAddress(DatabaseSession session) {
    StoredProcedureDefinition proc = new StoredProcedureDefinition();
    proc.setName("SProc_Read_Address");
    proc.addInOutputArgument("address_id_v", Integer.class);
    proc.addOutputArgument("street_v", String.class);
    proc.addOutputArgument("city_v", String.class);
    proc.addOutputArgument("country_v", String.class);
    proc.addOutputArgument("province_v", String.class);
    proc.addOutputArgument("p_code_v", String.class);
    String statement = null;
    if (session.getPlatform().isSQLServer() || session.getPlatform().isSybase()) {
        // 260263: SQLServer 2005/2008 requires parameter matching in the select clause for stored procedures
        statement = "SELECT @street_v=STREET, @city_v=CITY, @country_v=COUNTRY, @province_v=PROVINCE, @p_code_v=P_CODE FROM CMP3_ADDRESS WHERE ADDRESS_ID = @address_id_v";
    } else {
        statement = "SELECT STREET, CITY, COUNTRY, PROVINCE, P_CODE INTO street_v, city_v, country_v, province_v, p_code_v FROM CMP3_ADDRESS WHERE (ADDRESS_ID = address_id_v)";
    }
    proc.addStatement(statement);
    return proc;
}
Also used : StoredProcedureDefinition(org.eclipse.persistence.tools.schemaframework.StoredProcedureDefinition)

Example 5 with StoredProcedureDefinition

use of org.eclipse.persistence.tools.schemaframework.StoredProcedureDefinition in project eclipselink by eclipse-ee4j.

the class EmployeePopulator method buildStoredProcedureReadFromAddressMappedNumbered.

public StoredProcedureDefinition buildStoredProcedureReadFromAddressMappedNumbered(DatabasePlatform platform) {
    StoredProcedureDefinition proc = new StoredProcedureDefinition();
    proc.setName("XML_Read_Address_Numbered");
    proc.addArgument("address_id_v", Integer.class);
    String statement = null;
    if (platform.isSQLServer() || platform.isSybase()) {
        // 260263: SQLServer 2005/2008 requires parameter matching in the select clause for stored procedures
        statement = "SELECT ADDRESS_ID AS '1', STREET AS '2', CITY AS '3', COUNTRY AS '4', PROVINCE AS '5', P_CODE AS '6' FROM JPA21_XML_ADDRESS WHERE ADDRESS_ID = @ADDRESS_ID_V";
    } else {
        statement = "SELECT ADDRESS_ID AS '1', STREET AS '2', CITY AS '3', COUNTRY AS '4', PROVINCE AS '5', P_CODE AS '6' FROM JPA21_XML_ADDRESS WHERE (ADDRESS_ID = address_id_v)";
    }
    proc.addStatement(statement);
    return proc;
}
Also used : StoredProcedureDefinition(org.eclipse.persistence.tools.schemaframework.StoredProcedureDefinition)

Aggregations

StoredProcedureDefinition (org.eclipse.persistence.tools.schemaframework.StoredProcedureDefinition)64 DatabaseSession (org.eclipse.persistence.sessions.DatabaseSession)4 SchemaManager (org.eclipse.persistence.tools.schemaframework.SchemaManager)4 EntityManager (jakarta.persistence.EntityManager)2 Platform (org.eclipse.persistence.internal.databaseaccess.Platform)2 EntityManagerImpl (org.eclipse.persistence.internal.jpa.EntityManagerImpl)2 DatabasePlatform (org.eclipse.persistence.platform.database.DatabasePlatform)2 FieldDefinition (org.eclipse.persistence.tools.schemaframework.FieldDefinition)2