Class SQLExceptionComponentProvider

java.lang.Object
org.tentackle.trip.provider.ThrowableComponentProvider<SQLException>
org.tentackle.dbms.trip.SQLExceptionComponentProvider
All Implemented Interfaces:
org.tentackle.trip.TripComponentProvider<SQLException>

@TripComponentProviderService(SQLException.class) public class SQLExceptionComponentProvider extends org.tentackle.trip.provider.ThrowableComponentProvider<SQLException>
Component provider for SQLException.

Since the client usually doesn't have the JDBC driver on its classpath, no driver-specific class is transferred:

  • a driver-specific SQL exception is transferred as its nearest JDK superclass (see DbTripFactory), with the driver's class name appended to the message
  • a driver-specific cause, which is not an SQL exception, is replaced by an Exception carrying the original class name, message and stack trace
See Also:
  • Constructor Details

    • SQLExceptionComponentProvider

      public SQLExceptionComponentProvider()
      Creates the provider.
  • Method Details

    • getComponents

      public org.tentackle.trip.TripComponent<SQLException, ?>[] getComponents(org.tentackle.trip.TripType<SQLException> type)
      Specified by:
      getComponents in interface org.tentackle.trip.TripComponentProvider<SQLException>
      Overrides:
      getComponents in class org.tentackle.trip.provider.ThrowableComponentProvider<SQLException>
    • getTransferredCause

      protected static Throwable getTransferredCause(Throwable cause)
      Gets the cause to be transferred.
      SQL exceptions and the JDK's exceptions are transferred as they are. Any other exception, usually specific to the JDBC driver, is replaced by an Exception carrying the original's Throwable.toString() as its message and its stack trace.
      Parameters:
      cause - the cause
      Returns:
      the cause to transfer
    • addField

      protected boolean addField(Collection<org.tentackle.trip.TripComponent<SQLException, ?>> components, Field field, org.tentackle.trip.TripType<SQLException> type, int ordinal)
      Overrides:
      addField in class org.tentackle.trip.provider.ThrowableComponentProvider<SQLException>