I am not sure if this not really is a bug. StandardCacheEntryImpl calls TypeHelper.disassemble which causes the freshly converted (converttoEntityAttribute) attribute again to be converted the other way round (convertToDatabaseColumn). If this conversion is slow this is a problem. This is processed within one query.list() call. It would be nice if there was a way to suppress this forward and backward conversion that slows processing down a lot.
It ends up to be in AttributeConverterMutabilityPlan.deepCopyNotNull(). There I can see the convertToDatabaseColumn() method to be called immediately followed by a call to converttoEntityAttribute(). If I somehow could switch this off my application would be several orders of magnitude faster. What is this for?:
public class AttributeConverterMutabilityPlanImpl<T> extends MutableMutabilityPlan<T> { private final AttributeConverter attributeConverter;
public AttributeConverterMutabilityPlanImpl(AttributeConverter attributeConverter) { this.attributeConverter = attributeConverter; }
@Override @SuppressWarnings("unchecked") protected T deepCopyNotNull(T value) { return (T) attributeConverter.convertToEntityAttribute( attributeConverter.convertToDatabaseColumn( value ) ); } } Here is the relevant part of the stacktrace:
AttributeConverterMutabilityPlanImpl<T>.deepCopyNotNull(T) line: 29 AttributeConverterMutabilityPlanImpl<T>(MutableMutabilityPlan<T>).deepCopy(T) line: 35 AttributeConverterMutabilityPlanImpl<T>(MutableMutabilityPlan<T>).disassemble(T) line: 24 AttributeConverterTypeAdapter<T>(AbstractStandardBasicType<T>).disassemble(Object, SessionImplementor, Object) line: 284 TypeHelper.disassemble(Object[], Type[], boolean[], SessionImplementor, Object) line: 129 StandardCacheEntryImpl.<init>(Object[], EntityPersister, Object, SessionImplementor, Object) line: 55 AbstractEntityPersister$StandardCacheEntryHelper.buildCacheEntry(Object, Object[], Object, SessionImplementor) line: 5216 SingleTableEntityPersister(AbstractEntityPersister).buildCacheEntry(Object, Object[], Object, SessionImplementor) line: 4227 TwoPhaseLoad.doInitializeEntity(Object, EntityEntry, boolean, SessionImplementor, PreLoadEvent) line: 182 TwoPhaseLoad.initializeEntity(Object, boolean, SessionImplementor, PreLoadEvent) line: 125 QueryLoader(Loader).initializeEntitiesAndCollections(List, Object, SessionImplementor, boolean, List<AfterLoadAction>) line: 1139 QueryLoader(Loader).processResultSet(ResultSet, QueryParameters, SessionImplementor, boolean, ResultTransformer, int, List<AfterLoadAction>) line: 998 QueryLoader(Loader).doQuery(SessionImplementor, QueryParameters, boolean, ResultTransformer) line: 936 QueryLoader(Loader).doQueryAndInitializeNonLazyCollections(SessionImplementor, QueryParameters, boolean, ResultTransformer) line: 342 QueryLoader(Loader).doList(SessionImplementor, QueryParameters, ResultTransformer) line: 2622 QueryLoader(Loader).listUsingQueryCache(SessionImplementor, QueryParameters, Set<Serializable>, Type[]) line: 2464 QueryLoader(Loader).list(SessionImplementor, QueryParameters, Set<Serializable>, Type[]) line: 2426 QueryLoader.list(SessionImplementor, QueryParameters) line: 501 QueryTranslatorImpl.list(SessionImplementor, QueryParameters) line: 371 HQLQueryPlan.performList(QueryParameters, SessionImplementor) line: 216 SessionImpl.list(String, QueryParameters) line: 1339 QueryImpl.list() line: 87
|
|