Class JpqlExecutionResult

java.lang.Object
io.jmix.aitools.dataload.execution.JpqlExecutionResult

@NullMarked public class JpqlExecutionResult extends Object
  • Field Details

    • generatedJpqlResult

      protected GeneratedJpqlResult generatedJpqlResult
    • validationResult

      protected JpqlValidationResult validationResult
    • rows

      protected List<Map<String,Object>> rows
    • hasMore

      protected boolean hasMore
    • repaired

      protected boolean repaired
    • executed

      protected boolean executed
    • executionError

      protected @Nullable String executionError
    • maxResults

      protected @Nullable Integer maxResults
    • firstResult

      protected @Nullable Integer firstResult
  • Constructor Details

    • JpqlExecutionResult

      public JpqlExecutionResult(GeneratedJpqlResult generatedJpqlResult, JpqlValidationResult validationResult, List<Map<String,Object>> rows, @Nullable Integer maxResults, @Nullable Integer firstResult, boolean hasMore, boolean repaired, boolean executed, @Nullable String executionError)
      Parameters:
      generatedJpqlResult - generated (and possibly repaired) query draft
      validationResult - validation result of the processed query
      rows - fetched rows, each a property-name-to-value map
      maxResults - effective maximum number of rows
      firstResult - applied row offset
      hasMore - whether more rows are available beyond maxResults
      repaired - whether the query was repaired before execution
      executed - whether the query was actually executed
      executionError - error message from a failed execution
  • Method Details

    • failed

      public static JpqlExecutionResult failed(GeneratedJpqlResult generatedJpqlResult, JpqlValidationResult validationResult, boolean repaired)
      Creates a non-executed result for a query that failed validation.
      Parameters:
      generatedJpqlResult - generated (and possibly repaired) query draft
      validationResult - validation result of the processed query
      repaired - whether a repair attempt was made before validation failed
      Returns:
      non-executed result describing the validation failure
    • failed

      public static JpqlExecutionResult failed(GeneratedJpqlResult generatedJpqlResult, JpqlValidationResult validationResult, int maxResults, boolean repaired, @Nullable String executionError)
      Creates a non-executed result for a query that passed validation but failed at execution time.
      Parameters:
      generatedJpqlResult - generated (and possibly repaired) query draft
      validationResult - validation result of the processed query
      maxResults - effective maximum number of rows that was applied
      repaired - whether the query was repaired before execution
      executionError - error message from the failed execution, or null if unavailable
      Returns:
      non-executed result describing the execution failure
    • getGeneratedJpqlResult

      public GeneratedJpqlResult getGeneratedJpqlResult()
      Returns the generated (and possibly repaired) JPQL draft that was processed.
      Returns:
      generated query draft
    • getValidationResult

      public JpqlValidationResult getValidationResult()
      Returns the validation result of the processed query.
      Returns:
      validation result
    • getRows

      public List<Map<String,Object>> getRows()
      Returns the fetched rows as an unmodifiable list, each row being a property-name-to-value map. Empty if the query was not executed or returned nothing.
      Returns:
      fetched rows, never null
    • getMaxResults

      public @Nullable Integer getMaxResults()
      Returns the effective maximum number of rows that was applied.
      Returns:
      maximum number of rows, or null if unknown
    • getFirstResult

      public @Nullable Integer getFirstResult()
      Returns the row offset that was applied.
      Returns:
      row offset, or null if no offset was used
    • isHasMore

      public boolean isHasMore()
      Returns whether more rows are available beyond getMaxResults().
      Returns:
      true if more rows are available
    • isRepaired

      public boolean isRepaired()
      Returns whether the query was repaired before execution.
      Returns:
      true if the query was repaired
    • isExecuted

      public boolean isExecuted()
      Returns whether the query was actually executed against the data store.
      Returns:
      true if the query was executed
    • getExecutionError

      public @Nullable String getExecutionError()
      Returns the error message from a failed execution.
      Returns:
      execution error message, or null if execution succeeded or was never attempted