Methods Summary |
---|
public void | commit()Sends a commit to the connection currently in use.
try {
if( connection == null ) {
return;
}
if( connection.isClosed() ) {
throw new TransactionException("Invalid transactional state.");
}
connection.commit();
connection.close();
connection = null;
}
catch( SQLException e ) {
throw new TransactionException("Database error: " +
e.getMessage());
}
|
public java.sql.Connection | getConnection()Provides a JDBC Connection object to the persistence
handler implementing a persistence for a business object. This
method finds the connection by loading a DataSource
from a JNDI directory and asking the data source for the
connection. The data source name should be provided in the
imaginary.lwp.dataSouceName system property.
if( connection == null ) {
connection = getJDBCConnection();
try {
connection.setAutoCommit(false);
}
catch( SQLException e ) {
}
}
return connection;
|
public static java.sql.Connection | getJDBCConnection()
String url = System.getProperty("imaginary.lwp.jdbcURL");
String uid = System.getProperty("imaginary.lwp.user");
String pw = System.getProperty("imaginary.lwp.password");
Properties p = new Properties();
if( uid != null ) {
p.put("user", uid);
}
if( pw != null ) {
p.put("password", pw);
}
return DriverManager.getConnection(url, p);
|
public void | rollback()Tells the current connection to rollback.
try {
if( connection == null ) {
return;
}
if( connection.isClosed() ) {
throw new NullPointerException();
}
connection.rollback();
connection.close();
connection = null;
}
catch( SQLException e ) {
e.printStackTrace();
}
|