Methods Summary |
---|
public synchronized void | abort()Upon a successful JDBC rollback, this will trigger the
inherited abort() method.
try {
connection.rollback();
super.abort();
}
catch( SQLException e ) {
}
|
public synchronized void | commit()Upon a successful JDBC commit, this will call the inherited
commit in order to let all committed objects know the commit
was successful.
try {
connection.commit();
super.commit();
}
catch( SQLException e ) {
abort();
throw new PersistenceException(e);
}
|
public synchronized java.sql.Connection | getConnection()
return connection;
|
public synchronized void | restore(Persistent p)Restores a specific persistent object.
if( connection == null ) {
try {
connection = DriverManager.getConnection(url, props);
// comment out setAutoCommit() for mSQL
// which does not handle transaction logic
// connection.setAutoCommit(false);
}
catch( SQLException e ) {
throw new PersistenceException(e);
}
}
try {
super.restore(p);
}
finally {
try {
connection.close();
}
catch( SQLException e ) {
e.printStackTrace();
}
connection = null;
}
|
public synchronized void | restore(Persistent p, java.util.Hashtable data)Restores a persistent with the specified data.
if( connection == null ) {
try {
connection = DriverManager.getConnection(url, props);
}
catch( SQLException e ) {
throw new PersistenceException(e);
}
}
try {
super.restore(p, data);
}
finally {
try {
connection.close();
}
catch( SQLException e ) {
e.printStackTrace();
}
connection = null;
}
|
public synchronized void | restore(PersistentSet set, java.util.Hashtable data)Restores a PersistentSet based on the specified query criteria.
if( connection == null ) {
try {
connection = DriverManager.getConnection(url, props);
// connection.setAutoCommit(false);
}
catch( SQLException e ) {
throw new PersistenceException(e);
}
}
try {
super.restore(set, data);
}
finally {
try {
connection.close();
}
catch( SQLException e ) {
e.printStackTrace();
}
connection = null;
}
|
public synchronized void | save()Saves all of the objects associated with this object using
database persistence.
if( connection == null ) {
try {
connection = DriverManager.getConnection(url, props);
// connection.setAutoCommit(false);
}
catch( SQLException e ) {
throw new PersistenceException(e);
}
}
try {
super.save();
}
finally {
try {
if( connection != null ) {
connection.close();
}
}
catch( SQLException e ) {
e.printStackTrace();
}
connection = null;
}
|