org.hibernate.Query.getComment()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(1.8k)|赞(0)|评价(0)|浏览(178)

本文整理了Java中org.hibernate.Query.getComment方法的一些代码示例,展示了Query.getComment的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.getComment方法的具体详情如下:
包路径:org.hibernate.Query
类名称:Query
方法名:getComment

Query.getComment介绍

[英]Obtain the comment currently associated with this query. Provided SQL commenting is enabled (generally by enabling the hibernate.use_sql_comments config setting), this comment will also be added to the SQL query sent to the database. Often useful for identifying the source of troublesome queries on the database side.
[中]获取当前与此查询关联的注释。如果启用了SQL注释(通常通过启用hibernate.use_SQL_comments config设置),此注释也将添加到发送到数据库的SQL查询中。通常用于识别数据库端麻烦查询的来源。

代码示例

代码示例来源:origin: com.github.cafdataprocessing/corepolicy-hibernate

@Override
public String getComment() {
  return query.getComment();
}

代码示例来源:origin: riotfamily/riot

@Override
public String getComment() {
  return query.getComment();
}

代码示例来源:origin: org.n52.sensorweb.sos/do-hibernate

private void checkForPlaceholder(Query q, Set<TemporalFilter> filters) throws UnsupportedValueReferenceException {
  int count = 1;
  for (TemporalFilter filter : filters) {
    TimePrimitiveFieldDescriptor tpfd = TemporalRestrictions.getFields(filter.getValueReference());
    if (filter.getTime() instanceof TimePeriod) {
      TimePeriod tp = (TimePeriod) filter.getTime();
      if (q.getComment().contains(":" + TemporalRestriction.START)) {
        q.setParameter(TemporalRestriction.START + count, tp.getStart().toDate(), UtcTimestampType.INSTANCE);
      }
      if (q.getComment().contains(":" + TemporalRestriction.END)) {
        q.setParameter(TemporalRestriction.END + count, tp.getEnd().toDate(), UtcTimestampType.INSTANCE);
      }
    } if (filter.getTime() instanceof TimeInstant) {
      TimeInstant ti = (TimeInstant) filter.getTime();
      q.setParameter(TemporalRestriction.INSTANT + count, ti.getValue().toDate(), UtcTimestampType.INSTANCE);
    }
    count++;
  }
}

相关文章