Package org.iplass.mtp.entity.query.hint
Class HintComment
java.lang.Object
org.iplass.mtp.entity.query.hint.HintComment
- All Implemented Interfaces:
java.io.Serializable,ASTNode
public class HintComment extends java.lang.Object implements ASTNode
EQLのヒントコメントを表現します。
ヒントには、EQL上でのインデックス付与に関するヒント、バインド変数化に関するヒント、キャッシュ、クエリのタイムアウト、フェッチサイズに関するヒント、データベースネイティブのヒントなどを付与することが可能です。
ヒントコメントは、select句の後に/*+で始まり、*/で終わるコメント形式で指定することが可能です。
ヒントを追加したEQL例:
select /*+ fetch_size(100) index(c.x) no_index(a, b) native('ORDERED USE_NL_WITH_INDEX(...)') */ a, b, c.x, d.x, d.name from SampleEntity where c.x='hoge' and a=1 and b=15
また、ヒント句は外部のプロパティファイルに定義し、そのプロパティファイルからキー名を指定して読み込むことが可能です。 プロパティファイルのパスはQueryServiceに定義します。
プロパティファイルの記述例:
hint1=native(q0t0, 'FORCE INDEX(obj_store__USER_ISTR_index_3)') hint2=native(q0, 'FORCE INDEX(obj_store_ISTR_index_1)') :
外部ファイルからヒントを読み込むEQL例:
select /*+ @hint(hint1) */ a, b, c.x, d.x, d.name from SampleEntity where c.x='hoge' and a=1 and b=15上記設定ファイルの場合、これが、
select /*+ native(q0t0, 'FORCE INDEX(obj_store__USER_ISTR_index_3)') */ a, b, c.x, d.x, d.name from SampleEntity where c.x='hoge' and a=1 and b=15と展開されます。
また、Hint.externalHint(String)で外部ファイルに定義されるHintをインスタンスとして取得可能です。
-
Constructor Summary
Constructors Constructor Description HintComment()HintComment(java.lang.String hint)HintComment(java.util.List<Hint> hintList)HintComment(Hint... hint) -
Method Summary
Modifier and Type Method Description ASTNodeaccept(ASTTransformer transformer)voidaccept(HintVisitor visitor)HintCommentadd(java.util.List<Hint> hintList)HintCommentadd(Hint hint)booleanequals(java.lang.Object obj)java.util.List<Hint>getHintList()inthashCode()voidsetHintList(java.util.List<Hint> hintList)java.lang.StringtoString()
-
Constructor Details
-
HintComment
public HintComment() -
HintComment
-
HintComment
-
HintComment
public HintComment(java.lang.String hint)
-
-
Method Details
-
getHintList
-
setHintList
-
add
-
add
-
hashCode
public int hashCode() -
equals
public boolean equals(java.lang.Object obj) -
toString
public java.lang.String toString() -
accept
-
accept
-