Class JpqlDataLoader

All Implemented Interfaces:
ReportDataLoader, StreamingReportDataLoader

@NullMarked public class JpqlDataLoader extends AbstractDbDataLoader implements ReportDataLoader, StreamingReportDataLoader
  • Field Details

    • streamingFetchSizeByStore

      protected final Map<String,Integer> streamingFetchSizeByStore
      Cached JDBC streaming fetch size per data store — the database product does not change at runtime.
    • beanFactory

      @Autowired protected org.springframework.beans.factory.BeanFactory beanFactory
    • dataManager

      @Autowired protected DataManager dataManager
    • storeAwareLocator

      @Autowired protected StoreAwareLocator storeAwareLocator
    • groovyFeatureSupport

      @Autowired protected ReportsGroovyFeatureSupport groovyFeatureSupport
    • streamingFetchSize

      protected int streamingFetchSize
      JDBC fetch size for the streaming cursor.
    • cursorClearInterval

      protected int cursorClearInterval
      Release EclipseLink's internal row references every N rows.
  • Constructor Details

    • JpqlDataLoader

      public JpqlDataLoader()
  • Method Details

    • setStreamingFetchSize

      public void setStreamingFetchSize(int streamingFetchSize)
    • setCursorClearInterval

      public void setCursorClearInterval(int cursorClearInterval)
    • parseQueryOutputParametersNames

      protected List<AbstractDbDataLoader.OutputValue> parseQueryOutputParametersNames(String query)
    • loadData

      public List<Map<String,Object>> loadData(ReportQuery reportQuery, @Nullable BandData parentBand, Map<String,Object> params)
      Description copied from interface: ReportDataLoader
      This method MUST return list of mutable maps. We need mutability to put there some values implicitly.
      Specified by:
      loadData in interface ReportDataLoader
    • prepareJpqlQuery

      protected JpqlDataLoader.PreparedJpqlQuery prepareJpqlQuery(String query, @Nullable BandData parentBand, Map<String,Object> params, boolean processTemplate)
      Strips as "alias" entries from the JPQL text, capturing them as output value names.
    • loadDataStreaming

      public <T> T loadDataStreaming(ReportQuery reportQuery, @Nullable BandData parentBand, Map<String,Object> params, Function<Iterator<Map<String,Object>>,T> work)
      Streams rows from an EclipseLink cursor. The whole callback runs inside the store's transaction, keeping the cursor and lazy EntityMap attribute access valid for the entire render.
      Specified by:
      loadDataStreaming in interface StreamingReportDataLoader
    • resolveStreamingFetchSize

      protected int resolveStreamingFetchSize(String storeName)
      Cached per store (the database product is stable, so the metadata connection runs once per store). A transient detection failure is NOT cached: it falls back to the default for this call but lets the next report retry, so a one-off failure (e.g. a pool spike) does not pin MySQL to a buffering fetch size forever.
    • detectStreamingFetchSize

      protected @Nullable Integer detectStreamingFetchSize(String storeName)
      MySQL Connector/J ignores a positive fetch size and buffers the whole result set client-side; Integer.MIN_VALUE switches it (and MariaDB Connector/J) to row streaming. The EclipseLink cursor consumes rows forward-only, so the driver's row-streaming mode fits it. Mirrors SqlDataLoader#resolveStreamingFetchSize. Returns null on a transient failure so the caller can fall back without caching.
    • closeCursorQuietly

      protected void closeCursorQuietly(org.eclipse.persistence.queries.CursoredStream cursor, String dataSetName)
      Closes the EclipseLink cursor without letting a close failure escape: on a broken connection close() can throw, and in a finally that would replace the in-flight exception (masking a user cancel or formatter error and stripping the ReportingException type runReport routes on). Mirrors the SqlDataLoader teardown, which guards rollback/setAutoCommit the same way.
    • executeQuery

      protected @Nullable List executeQuery(BandData parentBand, Map<String,Object> params, String storeName, String query)
    • insertParameters

      protected jakarta.persistence.Query insertParameters(String query, String storeName, BandData parentBand, Map<String,Object> params)
    • insertParameterToQuery

      protected String insertParameterToQuery(String query, AbstractDbDataLoader.QueryParameter parameter)
      Overrides:
      insertParameterToQuery in class AbstractDbDataLoader
    • resolveNamedParameterName

      protected String resolveNamedParameterName(AbstractDbDataLoader.QueryParameter parameter)
    • processQueryTemplate

      protected String processQueryTemplate(String query, @Nullable BandData parentBand, Map<String,Object> reportParams)
      Overrides:
      processQueryTemplate in class AbstractDbDataLoader
    • trimQuery

      protected String trimQuery(String query)