#1183 - ENH: Add support for transaction profiling

This commit is contained in:
rob bygrave
2017-10-25 01:07:00 +13:00
parent 093f82a87f
commit 7ebef51859
46 changed files with 1063 additions and 68 deletions
@@ -253,6 +253,11 @@ public class DefaultOrmQuery<T> implements SpiQuery<T> {
private String nativeSql;
/**
* Identity the query for profiling purposes (expected to be unique for a bean type).
*/
private short profileId;
public DefaultOrmQuery(BeanDescriptor<T> desc, EbeanServer server, ExpressionFactory expressionFactory) {
this.beanDescriptor = desc;
this.beanType = desc.getBeanType();
@@ -280,6 +285,26 @@ public class DefaultOrmQuery<T> implements SpiQuery<T> {
}
}
@Override
public byte profileEventId() {
switch (mode) {
case LAZYLOAD_BEAN: return FIND_ONE_LAZY;
case LAZYLOAD_MANY: return FIND_MANY_LAZY;
default:
return type.profileEventId();
}
}
public short getProfileId() {
return profileId;
}
@Override
public Query<T> setProfileId(int profileId) {
this.profileId = (short)profileId;
return this;
}
@Override
public boolean isAutoTunable() {
return nativeSql == null && beanDescriptor.isAutoTunable();