ao-dbc-4.0.0
Release Notes
DatabaseAccessnow implements transactional methods instead of them only being onDatabase. This allows code to acceptDatabaseAccesswhile still being able to efficiently have its own transactional block. Previously,DatabaseAccesswas typically used only for one-off database calls.When transactional methods are via a
Databaseinstance, the implementation is the same as before. When the transactional methods are via aDatabaseConnection, they are directly implemented on the connection.-
New
DatabaseConnection.onCommit(…)andDatabaseConnection.onRollback(…)events. -
New set of methods that return
Optionalinstead of throwingNoRowException. Breaking change: Single-row
DatabaseAccess.queryObject(…),DatabaseAccess.updateObject(…), and all related more specific type methods will no longer returnnullwhen there is a row with a SQL NULL value, instead will throwNullDataException. This was already the behavior for primitive types (and related wrappers). This aligns the behavior across all types.When SQL NULL values are expected, use one of the new
DatabaseAccess.queryObjectNullable(…),DatabaseAccess.queryObjectOptionalNullable(…), or related more specific type methods.- Implemented remaining SQL types for formatted result set exceptions/logging.
ao-dbc-3.1.1
Release Notes
- Updated dependencies.
ao-dbc-3.1.0
Release Notes
- Localized exceptions now allow access to i18n resources used to generate localized message.
ao-dbc-3.0.0
Release Notes
- Minimum Java version changed from 1.8 to 11.
- Now supports Java 9+ modules with included
module-info.class. - Maven artifact relocated from
com.aoindustries:ao-dbctocom.aoapps:ao-dbc. - Package renamed from
com.aoindustries.dbctocom.aoapps.dbc.
ao-dbc-2.1.1
Release Notes
Fixed bug where
NoRowException(and similar) were being wrapped, which was interfering with catch blocks.Removed all uses of WrappedSQLException. Now registers SQL statements directly with
ErrorPrinterinstead. This allows the SQL statements to be logged while not altering exception types underneath the application.
ao-dbc-2.1.0
Release Notes
-
Added localization constructors to
ExtraRowException,NoRowException, andNullDataException.
ao-dbc-2.0.1
Release Notes
- Now subclassing more specific exception types where appropriate, instead of just using SQLException everywhere.
ao-dbc-2.0.0
Release Notes
createObjectnow unwraps cause fromInvocationTargetException.- Integrated support of
Throwable.addSuppressed(Throwable):DatabaseConnection.rollback()now throwsSQLException, instead of logging and returning.-
New
DatabaseConnection.rollback(Throwable)that adds any exceptions occurring during rollback to the given throwable viaThrowable.addSuppressed(Throwable). -
Deprecated
DatabaseConnection.rollbackAndClose()in favor of either explicitDatabaseConnection.rollback()or relying on the automatic rollback of transactions in-progress duringDatabaseConnection.close(). Furthermore, any connection with an unresolved fail-fast state will be validated and closed as-needed before being returned to the underlying connection pool. DatabaseConnection.rollbackAndClose()(now deprecated) now throwsSQLException, instead of logging and returning.-
New
DatabaseConnection.rollbackAndClose(Throwable)(also deprecated) that adds any exceptions occurring during rollback to the given throwable viaThrowable.addSuppressed(Throwable). Database.getConnection(…)now adds any exceptions occurring during clean-up (close and/or release connection) to the first throwable viaThrowable.addSuppressed(Throwable).DatabaseConnectionnow implementsAutoCloseable, with the expectation to by used via try-with-resources.
-
Any exception during
SQLDatainitialization will now clean-up properly (close and/or release connection). execute*(…)methods now also rollback on all types ofThrowableexceptThreadDeathandNoRowException, versus just handlingExceptionand below.AutoCloseableimplementation moved to a new classCloseableDatabase, which extendsDatabase. This allows the return ofDatabasein contexts where it is not expected to be closed.-
Now logs
SQLWarningfrom connections obtained from bothAOConnectionPoolandDataSource. Previously, warnings were only logged byAOConnectionPool. - Created
ObjectFactoryinstances for common types inObjectFactories. execute*Query(…)andexecute*Update(…)that return Java primitives, along with the specialized primitive-listexecuteIntList*(…)andexecuteLongList*(…), now throw a newNullDataExceptionwhen the result returns aNULLvalue.Previously, the default conversion was used. Any code that relied on this default conversion will need to be updated: a small lambda on
queryObject(…)orupdateObject(…)would do the trick.-
Moved base implementation methods from
AbstractDatabaseAccessabstract class to default methods on theDatabaseAccessinterface, then removedAbstractDatabaseAccess. - Declared throws of
ExtraRowExceptionwhere it may occur. - No longer automatically rollback transaction on
ExtraRowException. -
When
Database.getConnection(…)gets a connection from an underlyingDataSource, if the connection is not auto-commit, it will be rolled-back and set to auto-commit. As this is not expected to happen normally, a warning will be logged. Database.getConnection(…)will no longer perform automatic commits that were to facilitate read-only and transaction isolation level changes. Exceptions may now be thrown by the underlying JDBC driver when attempts are made to change read-only state or isolation levels during a transaction; this is a safer behavior.- Added support for primitive
doubleandfloatqueries and updates. - Added support for Java 8+ streaming queries and updates.
-
Deprecated
executeShortList*(…)methods. These offer no performance advantage overqueryList(…)combined withObjectFactories.Short, plus we do not have this type of list method for other wrapper types. -
Deprecated
executeObject*(…)methods that accept aClass<T>parameter. This class has its constructor accessed via reflection. This construct has been obsoleted by constructor lamdasClass::newused asObjectFactory. - Renamed
execute*Query(…)methods toquery*(…). - Renamed
execute*Update(…)methods toupdate*(…). -
Deprecated
ResultSetHandlerandResultSetHandlerEin favor of newResultSetRunnable,ResultSetRunnableE,ResultSetCallable, andResultSetCallableE. Having both runnable and callable variants allows implementations to not return anything. Previously, to satisfy the interface, something always had to be returned, even if just a(Void)null. -
Renamed
Database.executeTransaction(…)toDatabase.transactionCall(…)andDatabase.transactionRun(…). -
Added new methods
Database.transactionRun(RunnableE)andDatabase.transactionCall(CallableE), which are useful when a transaction scope is needed, but theDatabaseConnectionitself is not required. -
Renamed
Database.createDatabaseConnection()toconnect(). Since this method puts the burden of transaction management on the caller, please consider using the varioustransactionCall(…)ortransactionRun(…)methods. -
Added overloads of
Database.getConnection(…)andDatabaseConnection.getConnection(…), paralleling the methods of the underlyingAOConnectionPool. NullDataExceptionandExtraRowExceptionnow include a summary of the row as the exception message. This implementation adds AO Encoding as new dependency.-
Deprecated
Database.releaseConnection(Connection)andDatabaseConnection.releaseConnection()in favor ofConnection.close()for use in try-with-resources:- New protected method
Database.release(Connection)that performs the release. - This implementation adds AO Concurrent as new dependency.
- New protected method
- Changed generic bounds from specific to bounded, where appropriate.
- Generic exception upper bounds changed from
ExceptiontoThrowable. - Now pre-sizing collections when number of rows in result set is known.
- Added support for
executeLargeUpdate. -
Now uses the fail-fast state of the new
FailFastConnectionto know when to close or abort the underlying database connection. Now registering exception types for use with
Throwables.newSurrogate(…)that supports creating new instances of throwables in order to have caller stack trace. When wrapped, the original throwable is the cause of the new throwable. When not wrapped, the original throwable is used directly and caller stack trace is lost.This is used to maintain exception types and states across thread boundaries, such as when an exception cause is obtained from an
ExecutionException.- Defined SQLSTATE values for all SQLException.
Fetch size increased from 1000 to 10000 rows.
This value may be increased over time as the amount of typical system memory increases. As this may affect the number of round trips, and the speed of light is not likely to change, future increases may be of benefit.
- Added JDBC 4.2 Types.
ao-dbc-1.4.1
Release Notes
-
Fixed bug in
releaseConnectionthat would fail when trying to restore original type maps on a closed connection. Now checks that the connection is not closed first.
ao-dbc-1.4.0
Release Notes
- Minimum Java version changed from 1.7 to 1.8.
-
Reduced use of property substitutions in
pom.xml. This is to help 3rd-party parsers that fail to perform full Maven-compatible substitutions. Databaseis nowAutoCloseable, which closes the underlying pool.
ao-dbc-1.3.0
Release Notes
- Updated for compatibility with aocode-public-3.1.0.
ao-dbc-1.2.1
Release Notes
- Minimum Java version changed from 1.6 to 1.7.
- Using managed dependencies:
- This project uses managed dependencies.
- This project's managed dependencies may also be imported by other projects.
ao-dbc-1.2.0
Release Notes
-
New set of
execute*Updatemethods that mirror the short form ofexecute*Querymethods, but that do not operate read-only. This alleviates most of the uses of the longer form ofexecute*Query. Less is more - now get back to work! - Now supports the automatic loading of SQLData implementations via ServiceLoader.
- Now calling PreparedStatement.setObject(int, java.lang.Object) to give the database driver a chance to decide what to do.
ao-dbc-1.1.3
Release Notes
- Updated dependencies.
ao-dbc-1.1.2
Release Notes
- New AO OSS Parent POM to simplify
pom.xmlfiles. - Project documentation moved to per-project book in SemanticCMS format.
- Added changelog as top-level project link.
ao-dbc-1.1.1
Release Notes
- Improved Javadoc formatting.
- Improved README formatting.
ao-dbc-1.1.0
Release Notes
- Improved Javadoc formatting.
- Improved README formatting.
- Each lock object now a small empty class to help identify lock contention.
The lock contention profiler in NetBeans is just showing "java.lang.Object" all over, and can't seem to get from the lock object id to the actual object in the heap dump using OQL (id not found).
ao-dbc-1.0
Release Notes
- Project moved to GitHub and Maven.