コード例 #1
0
  /**
   * Adds the query to the named queries.
   *
   * @param name the name fo the query
   * @param query the query
   * @since 2.0.0
   */
  public void addNamedQuery(final String name, Query query) {
    final QueryImpl<?> typedQuery = (QueryImpl<?>) query;
    final String jpql = typedQuery.getCriteriaQuery().getJpql();

    new JpqlQuery(
        this,
        this.criteriaBuilder,
        new NamedQueryMetadata() {

          @Override
          public Map<String, Object> getHints() {
            return typedQuery.getHints();
          }

          @Override
          public AbstractLocator getLocator() {
            return null;
          }

          @Override
          public LockModeType getLockMode() {
            return typedQuery.getLockMode();
          }

          @Override
          public String getName() {
            return name;
          }

          @Override
          public String getQuery() {
            return jpql;
          }
        });
  }
コード例 #2
0
  /** {@inheritDoc} */
  @Override
  @SuppressWarnings("unchecked")
  public T handle(QueryImpl<?> query, SessionImpl session, ResultSet row) throws SQLException {
    final T value = query.getParameterValue(this);

    return (T) (this.getConverter() != null ? this.getConverter().convert(value) : value);
  }