Skip to content

Instantly share code, notes, and snippets.

@kwon37xi
Created December 18, 2017 09:47
Show Gist options
  • Save kwon37xi/7de8dbe1a8ac7d31995c945eee3f796d to your computer and use it in GitHub Desktop.
Save kwon37xi/7de8dbe1a8ac7d31995c945eee3f796d to your computer and use it in GitHub Desktop.
MySQLQuery와 JPASQLQuery 를 참조해서 만든 MySQLJPASQLQuery : QueryDSL 3.x
// MySQLQuery와 JPASQLQuery 를 참조해서 만든 MySQLJPASQLQuery : QueryDSL 3.x
public class MySQLJPASQLQuery extends AbstractJPASQLQuery<MySQLJPASQLQuery> {
private static final Joiner JOINER = Joiner.on(", ");
public MySQLJPASQLQuery(EntityManager entityManager, SQLTemplates sqlTemplates) {
super(entityManager, new Configuration(sqlTemplates));
}
public MySQLJPASQLQuery forceIndex(String... indexes) {
return addJoinFlag(" force index (" + JOINER.join(indexes) + ")", JoinFlag.Position.END);
}
public MySQLJPASQLQuery ignoreIndex(String... indexes) {
return addJoinFlag(" ignore index (" + JOINER.join(indexes) + ")", JoinFlag.Position.END);
}
public MySQLJPASQLQuery useIndex(String... indexes) {
return addJoinFlag(" use index (" + JOINER.join(indexes) + ")", JoinFlag.Position.END);
}
@Override
public MySQLJPASQLQuery clone(EntityManager entityManager) {
MySQLJPASQLQuery q = new MySQLJPASQLQuery(entityManager, configuration, queryHandler, getMetadata().clone());
q.clone(this);
return q;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment