protected void performValidCommit() {
protected int performValidCommit() {
    protected void performValidCommit() {	// in memory everything is ok, but we need to check against the db	PersistenceBroker pb = getOJBBroker();	try {	    if (! pb.isInTransaction()) {		pb.beginTransaction();	    }	    Connection conn = pb.serviceConnectionManager().getConnection();	    Statement stmt = conn.createStatement();	    	    try {		// obtain exclusive lock on db		ResultSet rs = stmt.executeQuery("SELECT GET_LOCK('ciapl.commitlock',100)");				if (rs.next() && (rs.getInt(1) == 1)) {		    // ensure that we will get the last data in the database		    conn.commit();		    		    if (TransactionChangeLogs.updateFromTxLogsOnDatabase(pb)) {			// if cache updated perform the tx-validation again			if (! validateCommit()) {			    throw new jvstm.CommitException();			}		    }		    		    super.performValidCommit();		    		    // ensure that changes are visible to other TXs before releasing lock		    conn.commit();		} else {		    throw new Error("Couldn't get exclusive commit lock on the database");		}	    } finally {		// release exclusive lock on db		// if the lock was not gained, calling RELEASE_LOCK has no effect		stmt.executeUpdate("DO RELEASE_LOCK('ciapl.commitlock')");	    }	    pb.commitTransaction();	    pb = null;	} catch (SQLException sqle) {	    throw new Error("Error while accessing database");	} catch (LookupException le) {	    throw new Error("Error while obtaining database connection");	} finally {	    if (pb != null) {		pb.abortTransaction();	    }	}    }