@Override protected void logStaticSQL() { if ( log.isDebugEnabled() ) { log.debug( "No SQL used when using OGM: " + getRole() ); } }
@SuppressWarnings("unchecked") private X doConversion(Object extractedValue) { try { X convertedValue = (X) converter.toDomainValue( extractedValue ); log.debugf( "Converted value on extraction: %s -> %s", extractedValue, convertedValue ); return convertedValue; } catch (PersistenceException pe) { throw pe; } catch (RuntimeException re) { throw log.failureWhenUsingAttributeConverter( converter.getClass(), re ); } } };
@Override public List<Tuple> getTuples(EntityKey[] keys, TupleContext tupleContext) { if ( log.isTraceEnabled() ) { log.tracef( "Reading tuples with keys %1$s and context %2$s", Arrays.toString( keys ), tupleContext ); } return super.getTuples( keys, tupleContext ); }
@Override public Association getAssociation(AssociationKey key, AssociationContext associationContext) { log.tracef( "Reading association with key %1$s from datastore and context %2$s", key, associationContext ); return super.getAssociation( key, associationContext ); }
@Override public List<?> loadEntityBatch(SharedSessionContractImplementor session, Serializable[] ids, Type idType, Object optionalObject, String optionalEntityName, Serializable optionalId, EntityPersister persister, LockOptions lockOptions) throws HibernateException { if ( log.isDebugEnabled() ) { log.debugf( "Batch loading entity: %s", MessageHelper.infoString( persister, ids, getFactory() ) ); } Type[] types = new Type[ids.length]; Arrays.fill( types, idType ); List result; try { QueryParameters qp = new QueryParameters(); qp.setPositionalParameterTypes( types ); qp.setPositionalParameterValues( ids ); qp.setOptionalObject( optionalObject ); qp.setOptionalEntityName( optionalEntityName ); qp.setOptionalId( optionalId ); qp.setLockOptions( lockOptions ); result = doQueryAndInitializeNonLazyCollections( session, qp, OgmLoadingContext.EMPTY_CONTEXT, false ); } catch ( Exception e ) { throw log.errorOnEntityBatchLoad( MessageHelper.infoString( getEntityPersisters()[0], ids, getFactory() ), e ); } log.debug( "Done entity batch load" ); return result; } }
throw log.gridDialectHasNoProperConstructor( clazz ); log.useGridDialect( gridDialect.getClass() ); if ( GridDialectLogger.activationNeeded() ) { gridDialect = new GridDialectLogger( gridDialect ); log.info( "Grid dialect logs are active" ); log.info( "Grid dialect logs are disabled" ); throw log.cannotInstantiateGridDialect( clazz, e );
super( persistentClass, cacheAccessStrategy, naturalIdRegionAccessStrategy, creationContext ); if ( log.isTraceEnabled() ) { log.tracef( "Creating OgmEntityPersister for %s", persistentClass.getClassName() ); throw log.getIdentityGenerationStrategyNotSupportedException( getEntityName() ); throw log.couldNotConfigureProperty( getEntityName(), getPropertyNames()[index], e );
@Override public void start() { log.debug( "MapDatastoreProvider started" ); }
log.debugf( "Targets for indexing job: %s", cleaned ); return IndexedTypeSets.fromClasses( cleaned.toArray( new Class[cleaned.size()] ) );
@Override public void executeBatch(OperationsQueue operationsQueue) { try { if ( GridDialects.hasFacet( getGridDialect(), BatchableGridDialect.class ) || GridDialects.hasFacet( getGridDialect(), GroupingByEntityDialect.class ) ) { log.tracef( "Executing batch" ); super.executeBatch( operationsQueue ); } } catch ( TupleAlreadyExistsException taee ) { // TODO: Ideally, we should log the entity name + id here; For now we trust the datastore to provide this // information via the original exception; It'd require a fair bit of changes to obtain the entity name here // (we'd have to obtain the persister matching the given entity key metadata which in turn would require // access to the session factory which is not easily available here) throw log.mustNotInsertSameEntityTwice( taee.getMessage(), taee ); } }
private static InfinispanEmbeddedDatastoreProvider getProvider(SessionFactoryImplementor factory) { DatastoreProvider service = factory.getServiceRegistry().getService( DatastoreProvider.class ); if ( service instanceof InfinispanEmbeddedDatastoreProvider ) { return InfinispanEmbeddedDatastoreProvider.class.cast( service ); } else { throw log.unexpectedDatastoreProvider( service.getClass(), InfinispanEmbeddedDatastoreProvider.class ); } }
@Override public QueryParsingResult parseQuery(SessionFactoryImplementor sessionFactory, String queryString) { QueryParser queryParser = new QueryParser(); Neo4jProcessingChain processingChain = createProcessingChain( sessionFactory ); Neo4jQueryParsingResult result = queryParser.parseQuery( queryString, processingChain ); log.createdQuery( queryString, result ); return result; }
/** * Used in the cases where {@link #determineSegmentValue} is unable to * determine the value to use. * * @param params The params supplied in the generator config (plus some standard useful extras). * * @return The default segment value to use. */ protected String determineDefaultSegmentValue(Properties params) { boolean preferSegmentPerEntity = ConfigurationHelper.getBoolean( CONFIG_PREFER_SEGMENT_PER_ENTITY, params, false ); String defaultToUse = preferSegmentPerEntity ? params.getProperty( PersistentIdentifierGenerator.TABLE ) : DEF_SEGMENT_VALUE; log.infof( "explicit segment value for id generator [%1$s.%2$s] suggested; using default [%3$s]", tableName, segmentColumnName, defaultToUse ); return defaultToUse; }
/** * Returns a converter instance for the given annotation. * * @param annotation the annotation * @return a converter instance or {@code null} if the given annotation is no option annotation */ private <A extends Annotation> AnnotationConverter<A> getConverter(Annotation annotation) { MappingOption mappingOption = annotation.annotationType().getAnnotation( MappingOption.class ); if ( mappingOption == null ) { return null; } // wrong type would be a programming error of the annotation developer @SuppressWarnings("unchecked") Class<? extends AnnotationConverter<A>> converterClass = (Class<? extends AnnotationConverter<A>>) mappingOption.value(); try { return converterClass.newInstance(); } catch (Exception e) { throw log.cannotConvertAnnotation( converterClass, e ); } }
private <E extends EntityContext<?, ?>> E createEntityMappingContext(Class<? extends E> entityContextImplType, Class<? extends PropertyContext<?, ?>> propertyContextImplType) { // ByteBuddyState#resolveClassLoadingStrategy static method is an Hibernate ORM internal, // please remove its use here as soon the issue HHH-13014 has been closed. // url https://hibernate.atlassian.net/browse/HHH-13014. Class<? extends E> entityContextType = new ByteBuddy() .subclass( entityContextImplType ) .method( filterEntityMethod().or( filterPropertyMethod() ) ) .intercept( to( new EntityOrPropertyMethodInterceptor( entityContextImplType, propertyContextImplType ) ) ) .make().load( entityContextImplType.getClassLoader(), resolveClassLoadingStrategy( entityContextImplType ) ).getLoaded(); try { return entityContextType.getConstructor( ConfigurationContext.class ).newInstance( this ); } catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) { throw log.cannotCreateEntityContextProxy( entityContextType, e ); } }
public static List<OptionValueSource> getDefaultSources(ConfigurationPropertyReader propertyReader) { AppendableConfigurationContext programmaticOptions = propertyReader.property( InternalProperties.OGM_OPTION_CONTEXT, AppendableConfigurationContext.class ) .instantiate() .getValue(); OptionConfigurator configurator = propertyReader.property( OgmProperties.OPTION_CONFIGURATOR, OptionConfigurator.class ) .instantiate() .getValue(); if ( configurator != null ) { if ( programmaticOptions != null ) { throw log.ambigiousOptionConfiguration( OgmProperties.OPTION_CONFIGURATOR ); } programmaticOptions = invokeOptionConfigurator( configurator ); } return programmaticOptions != null ? Arrays.<OptionValueSource>asList( new ProgrammaticOptionValueSource( programmaticOptions ), new AnnotationOptionValueSource(), new ConfigurationOptionValueSource( propertyReader ) ) : Arrays.<OptionValueSource>asList( new AnnotationOptionValueSource(), new ConfigurationOptionValueSource( propertyReader ) ); }
@Override public Tuple getTuple(EntityKey key, OperationContext operationContext) { log.tracef( "Reading tuple with key %1$s and context %2$s", key, operationContext ); return super.getTuple( key, operationContext ); }
@Override public void bind(Tuple resultset, X value, String[] names) { if ( value == null ) { for ( String name : names ) { log.tracef( "binding [null] to parameter [%1$s]", name ); resultset.put( name, null ); } } else { if ( log.isTraceEnabled() ) { log.tracef( "binding [%1$s] to parameter(s) %2$s", javaDescriptor.extractLoggableRepresentation( value ), Arrays.toString( names ) ); } doBind( resultset, value, names, DEFAULT_OPTIONS ); } }
@Override public void stop() { entitiesKeyValueStorage.clear(); associationsKeyValueStorage.clear(); sequencesStorage.clear(); dataLocks.clear(); //not nice but that's the best we can do acquiredLocksPerThread.remove(); log.debug( "Stopped and cleared MapDatastoreProvider" ); }