Thursday 5 January 2023

OADBTransactionImpl in Oracle Application Framework (OAF)

OADBTransactionImpl is a class in Oracle Application Framework (OAF), which is a framework for building Oracle E-Business Suite applications.
OADBTransactionImpl represents a database transaction in OAF. It provides methods for accessing and modifying data in the database, as well as for executing database queries and operations.
Here is an example of how you might use the OADBTransactionImpl class in an OAF application:

Example:

import oracle.apps.fnd.framework.OAApplicationModule;
import oracle.apps.fnd.framework.OAException;
import oracle.apps.fnd.framework.server.OADBTransactionImpl;

public class MyClass {
public void updateRecord(OAApplicationModule am, String recordId) throws OAException {
// Get a reference to the current database transaction
OADBTransactionImpl transaction = (OADBTransactionImpl)am.getOADBTransaction();
// Execute a SQL update statement to update a record in the database
String sql = "UPDATE my_table SET field1 = 'new value' WHERE id = :1";
transaction.executeSql(sql, new Object[] {recordId});
}
}

Here is a list of some of the methods of the Oracle Application Framework (OAF) OADBTransactionImpl class:
  • executeSql(String sql, Object[] bindArgs): Executes a SQL statement and returns the number of rows affected.
  • executeSqlStmt(String sql, Object[] bindArgs): Executes a SQL statement and returns a PreparedStatement object.
  • commit(): Commits the current database transaction.
  • rollback(): Rolls back the current database transaction.
  • getSequenceNumber(String sequenceName): Retrieves the next value from a database sequence.
  • getDBDate(Calendar calendar): Retrieves the current date and time from the database.
  • getDBTimestamp(Calendar calendar): Retrieves the current date and time, including fractions of a second, from the database.

Get XSID in oracle OAF - Value from cache

In Oracle Application Framework (OAF), you can use the getXSID() method of the OAFwkUtil class to get the current XSID (cross-session ID). The XSID is a unique identifier that is generated for each user session in OAF.

Here is an example of how you might use the getXSID() method in an OAF application:
Sql for this : select XSID from icx_sessions


Simple , You can use this (import this before any work WebAppsContext)

String xsid = webAppsContext.getEnvStore().setEnv("ICX_SESSION_COOKIE_VALUE");

Explanation:If you are trying to retrieve the value of the ICX_SESSION_COOKIE_VALUE environment variable and store it in a variable called xsid, you can use the getEnvStore().setEnv() method of the webAppsContext object in your code. This method will retrieve the value of the specified environment variable and store it in the xsid variable.

It is important to note that the getEnvStore().setEnv() method will only work if the ICX_SESSION_COOKIE_VALUE environment variable has been set in the environment where your code is running. If the variable has not been set, the setEnv() method will return null.

I hope this helps clarify how to retrieve the value of an environment variable using the getEnvStore().setEnv() method.

OADBTransactionImpl in Oracle Application Framework (OAF)

OADBTransactionImpl is a class in Oracle Application Framework (OAF), which is a framework for building Oracle E-Business Suite applications...