idx int64 0 41.2k | question stringlengths 83 4.15k | target stringlengths 5 715 |
|---|---|---|
23,900 | public List < Object > loadEntitiesFromTuples ( SharedSessionContractImplementor session , LockOptions lockOptions , OgmLoadingContext ogmContext ) { return loadEntity ( null , null , session , lockOptions , ogmContext ) ; } | Load a list of entities using the information in the context |
23,901 | public final void loadCollection ( final SharedSessionContractImplementor session , final Serializable id , final Type type ) throws HibernateException { if ( log . isDebugEnabled ( ) ) { log . debug ( "loading collection: " + MessageHelper . collectionInfoString ( getCollectionPersisters ( ) [ 0 ] , id , getFactory ( ... | Called by subclasses that initialize collections |
23,902 | private List < Object > doQueryAndInitializeNonLazyCollections ( SharedSessionContractImplementor session , QueryParameters qp , OgmLoadingContext ogmLoadingContext , boolean returnProxies ) { final PersistenceContext persistenceContext = session . getPersistenceContext ( ) ; boolean defaultReadOnlyOrig = persistenceCo... | Load the entity activating the persistence context execution boundaries |
23,903 | private List < Object > doQuery ( SharedSessionContractImplementor session , QueryParameters qp , OgmLoadingContext ogmLoadingContext , boolean returnProxies ) { int entitySpan = entityPersisters . length ; final List < Object > hydratedObjects = entitySpan == 0 ? null : new ArrayList < Object > ( entitySpan * 10 ) ; f... | Execute the physical query and initialize the various entities and collections |
23,904 | private void readCollectionElement ( final Object optionalOwner , final Serializable optionalKey , final CollectionPersister persister , final CollectionAliases descriptor , final ResultSet rs , final SharedSessionContractImplementor session ) throws HibernateException , SQLException { final PersistenceContext persiste... | Read one collection element from the current row of the JDBC result set |
23,905 | private void instanceAlreadyLoaded ( final Tuple resultset , final int i , final OgmEntityPersister persister , final org . hibernate . engine . spi . EntityKey key , final Object object , final LockMode lockMode , final SharedSessionContractImplementor session ) throws HibernateException { if ( ! persister . isInstanc... | The entity instance is already in the session cache |
23,906 | private Object instanceNotYetLoaded ( final Tuple resultset , final int i , final Loadable persister , final String rowIdAlias , final org . hibernate . engine . spi . EntityKey key , final LockMode lockMode , final org . hibernate . engine . spi . EntityKey optionalObjectKey , final Object optionalObject , final List ... | The entity instance is not in the session cache |
23,907 | private void registerNonExists ( final org . hibernate . engine . spi . EntityKey [ ] keys , final Loadable [ ] persisters , final SharedSessionContractImplementor session ) { final int [ ] owners = getOwners ( ) ; if ( owners != null ) { EntityType [ ] ownerAssociationTypes = getOwnerAssociationTypes ( ) ; for ( int i... | For missing objects associated by one - to - one with another object in the result set register the fact that the object is missing with the session . |
23,908 | public Rule CriteriaOnlyFindQuery ( ) { return Sequence ( ! peek ( ) . isCliQuery ( ) , JsonParameter ( JsonObject ( ) ) , peek ( ) . setOperation ( Operation . FIND ) , peek ( ) . setCriteria ( match ( ) ) ) ; } | A find query only given as criterion . Leave it to MongoDB s own parser to handle it . |
23,909 | public static Map < String , Object > introspect ( Object obj ) throws IntrospectionException , InvocationTargetException , IllegalAccessException { Map < String , Object > result = new HashMap < > ( ) ; BeanInfo info = Introspector . getBeanInfo ( obj . getClass ( ) ) ; for ( PropertyDescriptor pd : info . getProperty... | Introspect the given object . |
23,910 | public static boolean propertyExists ( Class < ? > clazz , String property , ElementType elementType ) { if ( ElementType . FIELD . equals ( elementType ) ) { return getDeclaredField ( clazz , property ) != null ; } else { String capitalizedPropertyName = capitalize ( property ) ; Method method = getMethod ( clazz , PR... | Whether the specified JavaBeans property exists on the given type or not . |
23,911 | public static void setField ( Object object , String field , Object value ) throws NoSuchMethodException , InvocationTargetException , IllegalAccessException { Class < ? > clazz = object . getClass ( ) ; Method m = clazz . getMethod ( PROPERTY_ACCESSOR_PREFIX_SET + capitalize ( field ) , value . getClass ( ) ) ; m . in... | Set value for given object field . |
23,912 | public boolean isEmbeddedProperty ( String targetTypeName , List < String > namesWithoutAlias ) { OgmEntityPersister persister = getPersister ( targetTypeName ) ; Type propertyType = persister . getPropertyType ( namesWithoutAlias . get ( 0 ) ) ; if ( propertyType . isComponentType ( ) ) { return true ; } else if ( pro... | Checks if the path leads to an embedded property or association . |
23,913 | public boolean isAssociation ( String targetTypeName , List < String > pathWithoutAlias ) { OgmEntityPersister persister = getPersister ( targetTypeName ) ; Type propertyType = persister . getPropertyType ( pathWithoutAlias . get ( 0 ) ) ; return propertyType . isAssociationType ( ) ; } | Check if the path to the property correspond to an association . |
23,914 | public List < String > findAssociationPath ( String targetTypeName , List < String > pathWithoutAlias ) { List < String > subPath = new ArrayList < String > ( pathWithoutAlias . size ( ) ) ; for ( String name : pathWithoutAlias ) { subPath . add ( name ) ; if ( isAssociation ( targetTypeName , subPath ) ) { return subP... | Find the path to the first association in the property path . |
23,915 | private static < R > RowKey buildRowKey ( AssociationKey associationKey , R row , AssociationRowAccessor < R > accessor ) { String [ ] columnNames = associationKey . getMetadata ( ) . getRowKeyColumnNames ( ) ; Object [ ] columnValues = new Object [ columnNames . length ] ; for ( int i = 0 ; i < columnNames . length ; ... | Creates the row key of the given association row ; columns present in the given association key will be obtained from there all other columns from the given native association row . |
23,916 | protected EntityKey getEntityKey ( Tuple tuple , AssociatedEntityKeyMetadata associatedEntityKeyMetadata ) { Object [ ] columnValues = new Object [ associatedEntityKeyMetadata . getAssociationKeyColumns ( ) . length ] ; int i = 0 ; for ( String associationKeyColumn : associatedEntityKeyMetadata . getAssociationKeyColum... | Returns the key of the entity targeted by the represented association retrieved from the given tuple . |
23,917 | public static boolean isPartOfRegularEmbedded ( String [ ] keyColumnNames , String column ) { return isPartOfEmbedded ( column ) && ! ArrayHelper . contains ( keyColumnNames , column ) ; } | A regular embedded is an element that it is embedded but it is not a key or a collection . |
23,918 | public String getOuterMostNullEmbeddableIfAny ( String column ) { String [ ] path = column . split ( "\\." ) ; if ( ! isEmbeddableColumn ( path ) ) { return null ; } if ( columnToOuterMostNullEmbeddableCache . containsKey ( column ) ) { return columnToOuterMostNullEmbeddableCache . get ( column ) ; } return determineAn... | Should only called on a column that is being set to null . |
23,919 | private String determineAndCacheOuterMostNullEmbeddable ( String column , String [ ] path ) { String embeddable = path [ 0 ] ; for ( int index = 0 ; index < path . length - 1 ; index ++ ) { Set < String > columnsOfEmbeddable = getColumnsOfEmbeddableAndComputeEmbeddableNullness ( embeddable ) ; if ( nullEmbeddables . co... | Walks from the most outer embeddable to the most inner one look for all columns contained in these embeddables and exclude the embeddables that have a non null column because of caching the algorithm is only run once per column parameter |
23,920 | public void addNavigationalInformationForInverseSide ( ) { if ( log . isTraceEnabled ( ) ) { log . trace ( "Adding inverse navigational information for entity: " + MessageHelper . infoString ( persister , id , persister . getFactory ( ) ) ) ; } for ( int propertyIndex = 0 ; propertyIndex < persister . getEntityMetamode... | Updates all inverse associations managed by a given entity . |
23,921 | public static String escapeDoubleQuotesForJson ( String text ) { if ( text == null ) { return null ; } StringBuilder builder = new StringBuilder ( text . length ( ) ) ; for ( int i = 0 ; i < text . length ( ) ; i ++ ) { char c = text . charAt ( i ) ; switch ( c ) { case '"' : case '\\' : builder . append ( "\\" ) ; def... | If a text contains double quotes escape them . |
23,922 | private static Row row ( List < StatementResult > results ) { Row row = results . get ( 0 ) . getData ( ) . get ( 0 ) ; return row ; } | When we execute a single statement we only need the corresponding Row with the result . |
23,923 | static < T extends GridDialect > T getDialectFacetOrNull ( GridDialect gridDialect , Class < T > facetType ) { if ( hasFacet ( gridDialect , facetType ) ) { @ SuppressWarnings ( "unchecked" ) T asFacet = ( T ) gridDialect ; return asFacet ; } return null ; } | Returns the given dialect narrowed down to the given dialect facet in case it is implemented by the dialect . |
23,924 | public static boolean hasFacet ( GridDialect gridDialect , Class < ? extends GridDialect > facetType ) { if ( gridDialect instanceof ForwardingGridDialect ) { return hasFacet ( ( ( ForwardingGridDialect < ? > ) gridDialect ) . getGridDialect ( ) , facetType ) ; } else { return facetType . isAssignableFrom ( gridDialect... | Whether the given grid dialect implements the specified facet or not . |
23,925 | public void initializePersistenceStrategy ( CacheMappingType cacheMappingType , Set < EntityKeyMetadata > entityTypes , Set < AssociationKeyMetadata > associationTypes , Set < IdSourceKeyMetadata > idSourceTypes , Iterable < Namespace > namespaces ) { persistenceStrategy = PersistenceStrategy . getInstance ( cacheMappi... | Initializes the persistence strategy to be used when accessing the datastore . In particular all the required caches will be configured and initialized . |
23,926 | private static Document getProjection ( List < String > fieldNames ) { Document projection = new Document ( ) ; for ( String column : fieldNames ) { projection . put ( column , 1 ) ; } return projection ; } | Returns a projection object for specifying the fields to retrieve during a specific find operation . |
23,927 | private static Document objectForInsert ( Tuple tuple , Document dbObject ) { MongoDBTupleSnapshot snapshot = ( MongoDBTupleSnapshot ) tuple . getSnapshot ( ) ; for ( TupleOperation operation : tuple . getOperations ( ) ) { String column = operation . getColumn ( ) ; if ( notInIdField ( snapshot , column ) ) { switch (... | Creates a Document that can be passed to the MongoDB batch insert function |
23,928 | private static ClosableIterator < Tuple > doDistinct ( final MongoDBQueryDescriptor queryDescriptor , final MongoCollection < Document > collection ) { DistinctIterable < ? > distinctFieldValues = collection . distinct ( queryDescriptor . getDistinctFieldName ( ) , queryDescriptor . getCriteria ( ) , String . class ) ;... | do Distinct operation |
23,929 | @ SuppressWarnings ( "deprecation" ) private static WriteConcern mergeWriteConcern ( WriteConcern original , WriteConcern writeConcern ) { if ( original == null ) { return writeConcern ; } else if ( writeConcern == null ) { return original ; } else if ( original . equals ( writeConcern ) ) { return original ; } Object ... | As we merge several operations into one operation we need to be sure the write concern applied to the aggregated operation respects all the requirements expressed for each separate operation . |
23,930 | public ClosableIterator < Tuple > callStoredProcedure ( String storedProcedureName , ProcedureQueryParameters params , TupleContext tupleContext ) { validate ( params ) ; StringBuilder commandLine = createCallStoreProcedureCommand ( storedProcedureName , params ) ; Document result = callStoredProcedure ( commandLine ) ... | In MongoDB the equivalent of a stored procedure is a stored Javascript . |
23,931 | public UniqueEntityLoader buildLoader ( OuterJoinLoadable persister , int batchSize , LockMode lockMode , SessionFactoryImplementor factory , LoadQueryInfluencers influencers , BatchableEntityLoaderBuilder innerEntityLoaderBuilder ) { if ( batchSize <= 1 ) { return buildNonBatchingLoader ( persister , lockMode , factor... | Builds a batch - fetch capable loader based on the given persister lock - mode etc . |
23,932 | public UniqueEntityLoader buildLoader ( OuterJoinLoadable persister , int batchSize , LockOptions lockOptions , SessionFactoryImplementor factory , LoadQueryInfluencers influencers , BatchableEntityLoaderBuilder innerEntityLoaderBuilder ) { if ( batchSize <= 1 ) { return buildNonBatchingLoader ( persister , lockOptions... | Builds a batch - fetch capable loader based on the given persister lock - options etc . |
23,933 | private void applyProperties ( AssociationKey associationKey , Tuple associationRow , Relationship relationship ) { String [ ] indexColumns = associationKey . getMetadata ( ) . getRowKeyIndexColumnNames ( ) ; for ( int i = 0 ; i < indexColumns . length ; i ++ ) { String propertyName = indexColumns [ i ] ; Object proper... | The only properties added to a relationship are the columns representing the index of the association . |
23,934 | public Association getAssociation ( String collectionRole ) { if ( associations == null ) { return null ; } return associations . get ( collectionRole ) ; } | Return the association as cached in the entry state . |
23,935 | public void setAssociation ( String collectionRole , Association association ) { if ( associations == null ) { associations = new HashMap < > ( ) ; } associations . put ( collectionRole , association ) ; } | Set the association in the entry state . |
23,936 | public void addExtraState ( EntityEntryExtraState extraState ) { if ( next == null ) { next = extraState ; } else { next . addExtraState ( extraState ) ; } } | state chain management ops below |
23,937 | protected StrongCounter getCounterOrCreateIt ( String counterName , int initialValue ) { CounterManager counterManager = EmbeddedCounterManagerFactory . asCounterManager ( cacheManager ) ; if ( ! counterManager . isDefined ( counterName ) ) { LOG . tracef ( "Counter %s is not defined, creating it" , counterName ) ; val... | Create a counter if one is not defined already otherwise return the existing one . |
23,938 | public Set < TupleOperation > getOperations ( ) { if ( currentState == null ) { return Collections . emptySet ( ) ; } else { return new SetFromCollection < TupleOperation > ( currentState . values ( ) ) ; } } | Return the list of actions on the tuple . Inherently deduplicated operations |
23,939 | private < A extends Annotation > AnnotationConverter < A > getConverter ( Annotation annotation ) { MappingOption mappingOption = annotation . annotationType ( ) . getAnnotation ( MappingOption . class ) ; if ( mappingOption == null ) { return null ; } @ SuppressWarnings ( "unchecked" ) Class < ? extends AnnotationConv... | Returns a converter instance for the given annotation . |
23,940 | public static String [ ] slice ( String [ ] strings , int begin , int length ) { String [ ] result = new String [ length ] ; System . arraycopy ( strings , begin , result , 0 , length ) ; return result ; } | Create a smaller array from an existing one . |
23,941 | public static < T > int indexOf ( T [ ] array , T element ) { for ( int i = 0 ; i < array . length ; i ++ ) { if ( array [ i ] . equals ( element ) ) { return i ; } } return - 1 ; } | Return the position of an element inside an array |
23,942 | public static < T > T [ ] concat ( T [ ] first , T ... second ) { int firstLength = first . length ; int secondLength = second . length ; @ SuppressWarnings ( "unchecked" ) T [ ] result = ( T [ ] ) Array . newInstance ( first . getClass ( ) . getComponentType ( ) , firstLength + secondLength ) ; System . arraycopy ( fi... | Concats two arrays . |
23,943 | public static < T > T [ ] concat ( T firstElement , T ... array ) { @ SuppressWarnings ( "unchecked" ) T [ ] result = ( T [ ] ) Array . newInstance ( firstElement . getClass ( ) , 1 + array . length ) ; result [ 0 ] = firstElement ; System . arraycopy ( array , 0 , result , 1 , array . length ) ; return result ; } | Concats an element and an array . |
23,944 | private Serializable doWorkInIsolationTransaction ( final SharedSessionContractImplementor session ) throws HibernateException { class Work extends AbstractReturningWork < IntegralDataTypeHolder > { private final SharedSessionContractImplementor localSession = session ; public IntegralDataTypeHolder execute ( Connectio... | copied and altered from TransactionHelper |
23,945 | public static void registerOgmExternalizers ( SerializationConfigurationBuilder cfg ) { for ( AdvancedExternalizer < ? > advancedExternalizer : ogmExternalizers . values ( ) ) { cfg . addAdvancedExternalizer ( advancedExternalizer ) ; } } | Registers all custom Externalizer implementations that Hibernate OGM needs into an Infinispan CacheManager configuration . |
23,946 | public static void registerOgmExternalizers ( GlobalConfiguration globalCfg ) { Map < Integer , AdvancedExternalizer < ? > > externalizerMap = globalCfg . serialization ( ) . advancedExternalizers ( ) ; externalizerMap . putAll ( ogmExternalizers ) ; } | Registers all custom Externalizer implementations that Hibernate OGM needs into a running Infinispan CacheManager configuration . This is only safe to do when Caches from this CacheManager haven t been started yet or the ones already started do not contain any data needing these . |
23,947 | public static void validateExternalizersPresent ( EmbeddedCacheManager externalCacheManager ) { Map < Integer , AdvancedExternalizer < ? > > externalizerMap = externalCacheManager . getCacheManagerConfiguration ( ) . serialization ( ) . advancedExternalizers ( ) ; for ( AdvancedExternalizer < ? > ogmExternalizer : ogmE... | Verify that all OGM custom externalizers are present . N . B . even if some Externalizer is only needed in specific configuration it is not safe to start a CacheManager without one as the same CacheManager might be used or have been used in the past to store data using a different configuration . |
23,948 | public void writeLock ( EntityKey key , int timeout ) { ReadWriteLock lock = getLock ( key ) ; Lock writeLock = lock . writeLock ( ) ; acquireLock ( key , timeout , writeLock ) ; } | Acquires a write lock on a specific key . |
23,949 | public void readLock ( EntityKey key , int timeout ) { ReadWriteLock lock = getLock ( key ) ; Lock readLock = lock . readLock ( ) ; acquireLock ( key , timeout , readLock ) ; } | Acquires a read lock on a specific key . |
23,950 | public Map < AssociationKey , Map < RowKey , Map < String , Object > > > getAssociationsMap ( ) { return Collections . unmodifiableMap ( associationsKeyValueStorage ) ; } | Meant to execute assertions in tests only |
23,951 | public static String flatten ( String left , String right ) { return left == null || left . isEmpty ( ) ? right : left + "." + right ; } | Links the two field names into a single left . right field name . If the left field is empty right is returned |
23,952 | public static boolean organizeAssociationMapByRowKey ( org . hibernate . ogm . model . spi . Association association , AssociationKey key , AssociationContext associationContext ) { if ( association . isEmpty ( ) ) { return false ; } if ( key . getMetadata ( ) . getRowKeyIndexColumnNames ( ) . length != 1 ) { return fa... | Whether the rows of the given association should be stored in a hash using the single row key column as key or not . |
23,953 | private void scheduleBatchLoadIfNeeded ( Serializable id , SharedSessionContractImplementor session ) throws MappingException { if ( StringHelper . isEmpty ( delegate . getRHSUniqueKeyPropertyName ( ) ) && id != null ) { EntityPersister persister = session . getFactory ( ) . getMetamodel ( ) . entityPersister ( delegat... | Register the entity as batch loadable if enabled |
23,954 | public GeoMultiPoint addPoint ( GeoPoint point ) { Contracts . assertNotNull ( point , "point" ) ; this . points . add ( point ) ; return this ; } | Adds a new point . |
23,955 | public String findAlias ( String entityAlias , List < String > propertyPathWithoutAlias ) { RelationshipAliasTree aliasTree = relationshipAliases . get ( entityAlias ) ; if ( aliasTree == null ) { return null ; } RelationshipAliasTree associationAlias = aliasTree ; for ( int i = 0 ; i < propertyPathWithoutAlias . size ... | Given the alias of the entity and the path to the relationship it will return the alias of the component . |
23,956 | public Node createEmbedded ( GraphDatabaseService executionEngine , Object [ ] columnValues ) { Map < String , Object > params = params ( columnValues ) ; Result result = executionEngine . execute ( getCreateEmbeddedNodeQuery ( ) , params ) ; return singleResult ( result ) ; } | Create a single node representing an embedded element . |
23,957 | public Node findEntity ( GraphDatabaseService executionEngine , Object [ ] columnValues ) { Map < String , Object > params = params ( columnValues ) ; Result result = executionEngine . execute ( getFindEntityQuery ( ) , params ) ; return singleResult ( result ) ; } | Find the node corresponding to an entity . |
23,958 | public Node insertEntity ( GraphDatabaseService executionEngine , Object [ ] columnValues ) { Map < String , Object > params = params ( columnValues ) ; Result result = executionEngine . execute ( getCreateEntityQuery ( ) , params ) ; return singleResult ( result ) ; } | Creates the node corresponding to an entity . |
23,959 | public ResourceIterator < Node > findEntities ( GraphDatabaseService executionEngine ) { Result result = executionEngine . execute ( getFindEntitiesQuery ( ) ) ; return result . columnAs ( BaseNeo4jEntityQueries . ENTITY_ALIAS ) ; } | Find all the node representing the entity . |
23,960 | public void removeEntity ( GraphDatabaseService executionEngine , Object [ ] columnValues ) { Map < String , Object > params = params ( columnValues ) ; executionEngine . execute ( getRemoveEntityQuery ( ) , params ) ; } | Remove the nodes representing the entity and the embedded elements attached to it . |
23,961 | public void updateEmbeddedColumn ( GraphDatabaseService executionEngine , Object [ ] keyValues , String embeddedColumn , Object value ) { String query = getUpdateEmbeddedColumnQuery ( keyValues , embeddedColumn ) ; Map < String , Object > params = params ( ArrayHelper . concat ( keyValues , value , value ) ) ; executio... | Update the value of an embedded node property . |
23,962 | private static IndexOptions prepareOptions ( MongoDBIndexType indexType , Document options , String indexName , boolean unique ) { IndexOptions indexOptions = new IndexOptions ( ) ; indexOptions . name ( indexName ) . unique ( unique ) . background ( options . getBoolean ( "background" , false ) ) ; if ( unique ) { ind... | Prepare the options by adding additional information to them . |
23,963 | public static AssociationKeyMetadata getInverseAssociationKeyMetadata ( OgmEntityPersister mainSidePersister , int propertyIndex ) { Type propertyType = mainSidePersister . getPropertyTypes ( ) [ propertyIndex ] ; SessionFactoryImplementor factory = mainSidePersister . getFactory ( ) ; if ( ! propertyType . isAssociati... | Returns the meta - data for the inverse side of the association represented by the given property on the given persister in case it represents the main side of a bi - directional one - to - many or many - to - many association . |
23,964 | public static OgmCollectionPersister getInverseCollectionPersister ( OgmCollectionPersister mainSidePersister ) { if ( mainSidePersister . isInverse ( ) || ! mainSidePersister . isManyToMany ( ) || ! mainSidePersister . getElementType ( ) . isEntityType ( ) ) { return null ; } EntityPersister inverseSidePersister = mai... | Returns the given collection persister for the inverse side in case the given persister represents the main side of a bi - directional many - to - many association . |
23,965 | private static boolean isCollectionMatching ( Joinable mainSideJoinable , OgmCollectionPersister inverseSidePersister ) { boolean isSameTable = mainSideJoinable . getTableName ( ) . equals ( inverseSidePersister . getTableName ( ) ) ; if ( ! isSameTable ) { return false ; } return Arrays . equals ( mainSideJoinable . g... | Checks whether table name and key column names of the given joinable and inverse collection persister match . |
23,966 | public static void resetValue ( Document entity , String column ) { if ( ! column . contains ( "." ) ) { entity . remove ( column ) ; } else { String [ ] path = DOT_SEPARATOR_PATTERN . split ( column ) ; Object field = entity ; int size = path . length ; for ( int index = 0 ; index < size ; index ++ ) { String node = p... | Remove a column from the Document |
23,967 | private static void validateAsMongoDBCollectionName ( String collectionName ) { Contracts . assertStringParameterNotEmpty ( collectionName , "requestedName" ) ; if ( collectionName . startsWith ( "system." ) ) { throw log . collectionNameHasInvalidSystemPrefix ( collectionName ) ; } else if ( collectionName . contains ... | Validates a String to be a valid name to be used in MongoDB for a collection name . |
23,968 | private void validateAsMongoDBFieldName ( String fieldName ) { if ( fieldName . startsWith ( "$" ) ) { throw log . fieldNameHasInvalidDollarPrefix ( fieldName ) ; } else if ( fieldName . contains ( "\u0000" ) ) { throw log . fieldNameContainsNULCharacter ( fieldName ) ; } } | Validates a String to be a valid name to be used in MongoDB for a field name . |
23,969 | private static int determineBatchSize ( boolean canGridDialectDoMultiget , int classBatchSize , int configuredDefaultBatchSize ) { if ( ! canGridDialectDoMultiget ) { return - 1 ; } else if ( classBatchSize != - 1 ) { return classBatchSize ; } else if ( configuredDefaultBatchSize != - 1 ) { return configuredDefaultBatc... | Returns the effective batch size . If the dialect is multiget capable and a batch size has been configured use that one otherwise the default . |
23,970 | private String getInverseOneToOneProperty ( String property , OgmEntityPersister otherSidePersister ) { for ( String candidate : otherSidePersister . getPropertyNames ( ) ) { Type candidateType = otherSidePersister . getPropertyType ( candidate ) ; if ( candidateType . isEntityType ( ) && ( ( ( EntityType ) candidateTy... | Returns the name from the inverse side if the given property de - notes a one - to - one association . |
23,971 | public Object [ ] getDatabaseSnapshot ( Serializable id , SharedSessionContractImplementor session ) throws HibernateException { if ( log . isTraceEnabled ( ) ) { log . trace ( "Getting current persistent state for: " + MessageHelper . infoString ( this , id , getFactory ( ) ) ) ; } final Tuple resultset = getFreshTupl... | This snapshot is meant to be used when updating data . |
23,972 | private Object initializeLazyPropertiesFromCache ( final String fieldName , final Object entity , final SharedSessionContractImplementor session , final EntityEntry entry , final CacheEntry cacheEntry ) { throw new NotSupportedException ( "OGM-9" , "Lazy properties not supported in OGM" ) ; } | Make superclasses method protected?? |
23,973 | public Object getCurrentVersion ( Serializable id , SharedSessionContractImplementor session ) throws HibernateException { if ( log . isTraceEnabled ( ) ) { log . trace ( "Getting version: " + MessageHelper . infoString ( this , id , getFactory ( ) ) ) ; } final Tuple resultset = getFreshTuple ( EntityKeyBuilder . from... | Retrieve the version number |
23,974 | private boolean isAllOrDirtyOptLocking ( ) { EntityMetamodel entityMetamodel = getEntityMetamodel ( ) ; return entityMetamodel . getOptimisticLockStyle ( ) == OptimisticLockStyle . DIRTY || entityMetamodel . getOptimisticLockStyle ( ) == OptimisticLockStyle . ALL ; } | Copied from AbstractEntityPersister |
23,975 | private void removeFromInverseAssociations ( Tuple resultset , int tableIndex , Serializable id , SharedSessionContractImplementor session ) { new EntityAssociationUpdater ( this ) . id ( id ) . resultset ( resultset ) . session ( session ) . tableIndex ( tableIndex ) . propertyMightRequireInverseAssociationManagement ... | Removes the given entity from the inverse associations it manages . |
23,976 | private void addToInverseAssociations ( Tuple resultset , int tableIndex , Serializable id , SharedSessionContractImplementor session ) { new EntityAssociationUpdater ( this ) . id ( id ) . resultset ( resultset ) . session ( session ) . tableIndex ( tableIndex ) . propertyMightRequireInverseAssociationManagement ( pro... | Adds the given entity to the inverse associations it manages . |
23,977 | private void processGeneratedProperties ( Serializable id , Object entity , Object [ ] state , SharedSessionContractImplementor session , GenerationTiming matchTiming ) { Tuple tuple = getFreshTuple ( EntityKeyBuilder . fromPersister ( this , id , session ) , session ) ; saveSharedTuple ( entity , tuple , session ) ; i... | Re - reads the given entity refreshing any properties updated on the server - side during insert or update . |
23,978 | private boolean isReadRequired ( ValueGeneration valueGeneration , GenerationTiming matchTiming ) { return valueGeneration != null && valueGeneration . getValueGenerator ( ) == null && timingsMatch ( valueGeneration . getGenerationTiming ( ) , matchTiming ) ; } | Whether the given value generation strategy requires to read the value from the database or not . |
23,979 | public static List < Object > listOfEntities ( SharedSessionContractImplementor session , Type [ ] resultTypes , ClosableIterator < Tuple > tuples ) { Class < ? > returnedClass = resultTypes [ 0 ] . getReturnedClass ( ) ; TupleBasedEntityLoader loader = getLoader ( session , returnedClass ) ; OgmLoadingContext ogmLoadi... | At the moment we only support the case where one entity type is returned |
23,980 | private void doBatchWork ( BatchBackend backend ) throws InterruptedException { ExecutorService executor = Executors . newFixedThreadPool ( typesToIndexInParallel , "BatchIndexingWorkspace" ) ; for ( IndexedTypeIdentifier indexedTypeIdentifier : rootIndexedTypes ) { executor . execute ( new BatchIndexingWorkspace ( gri... | Will spawn a thread for each type in rootEntities they will all re - join on endAllSignal when finished . |
23,981 | private void afterBatch ( BatchBackend backend ) { IndexedTypeSet targetedTypes = searchFactoryImplementor . getIndexedTypesPolymorphic ( rootIndexedTypes ) ; if ( this . optimizeAtEnd ) { backend . optimize ( targetedTypes ) ; } backend . flush ( targetedTypes ) ; } | Operations to do after all subthreads finished their work on index |
23,982 | private void beforeBatch ( BatchBackend backend ) { if ( this . purgeAtStart ) { IndexedTypeSet targetedTypes = searchFactoryImplementor . getIndexedTypesPolymorphic ( rootIndexedTypes ) ; for ( IndexedTypeIdentifier type : targetedTypes ) { backend . doWorkInSync ( new PurgeAllLuceneWork ( tenantId , type ) ) ; } if (... | Optional operations to do before the multiple - threads start indexing |
23,983 | public static < T > Set < T > asSet ( T ... ts ) { if ( ts == null ) { return null ; } else if ( ts . length == 0 ) { return Collections . emptySet ( ) ; } else { Set < T > set = new HashSet < T > ( getInitialCapacityFromExpectedSize ( ts . length ) ) ; Collections . addAll ( set , ts ) ; return Collections . unmodifia... | Returns an unmodifiable set containing the given elements . |
23,984 | private boolean isOrdinal ( int paramType ) { switch ( paramType ) { case Types . INTEGER : case Types . NUMERIC : case Types . SMALLINT : case Types . TINYINT : case Types . BIGINT : case Types . DECIMAL : case Types . DOUBLE : case Types . FLOAT : return true ; case Types . CHAR : case Types . LONGVARCHAR : case Type... | in truth we probably only need the types as injected by the metadata binder |
23,985 | public ClosableIterator < Tuple > callStoredProcedure ( EmbeddedCacheManager embeddedCacheManager , String storedProcedureName , ProcedureQueryParameters queryParameters , ClassLoaderService classLoaderService ) { validate ( queryParameters ) ; Cache < String , String > cache = embeddedCacheManager . getCache ( STORED_... | Returns the result of a stored procedure executed on the backend . |
23,986 | public static String getPrefix ( String column ) { return column . contains ( "." ) ? DOT_SEPARATOR_PATTERN . split ( column ) [ 0 ] : null ; } | If the column name is a dotted column returns the first part . Returns null otherwise . |
23,987 | public static String getColumnSharedPrefix ( String [ ] associationKeyColumns ) { String prefix = null ; for ( String column : associationKeyColumns ) { String newPrefix = getPrefix ( column ) ; if ( prefix == null ) { prefix = newPrefix ; if ( prefix == null ) { break ; } } else { if ( ! equals ( prefix , newPrefix ) ... | Returns the shared prefix of these columns . Null otherwise . |
23,988 | public static ThreadPoolExecutor newFixedThreadPool ( int threads , String groupname , int queueSize ) { return new ThreadPoolExecutor ( threads , threads , 0L , TimeUnit . MILLISECONDS , new LinkedBlockingQueue < Runnable > ( queueSize ) , new SearchThreadFactory ( groupname ) , new BlockPolicy ( ) ) ; } | Creates a new fixed size ThreadPoolExecutor |
23,989 | public static void readAndCheckVersion ( ObjectInput input , int supportedVersion , Class < ? > externalizedType ) throws IOException { int version = input . readInt ( ) ; if ( version != supportedVersion ) { throw LOG . unexpectedKeyVersion ( externalizedType , version , supportedVersion ) ; } } | Consumes the version field from the given input and raises an exception if the record is in a newer version written by a newer version of Hibernate OGM . |
23,990 | public static boolean matches ( Map < String , Object > nodeProperties , String [ ] keyColumnNames , Object [ ] keyColumnValues ) { for ( int i = 0 ; i < keyColumnNames . length ; i ++ ) { String property = keyColumnNames [ i ] ; Object expectedValue = keyColumnValues [ i ] ; boolean containsProperty = nodeProperties .... | Check if the node matches the column values |
23,991 | public GeoPolygon addHoles ( List < List < GeoPoint > > holes ) { Contracts . assertNotNull ( holes , "holes" ) ; this . rings . addAll ( holes ) ; return this ; } | Adds new holes to the polygon . |
23,992 | public void addAll ( OptionsContainerBuilder container ) { for ( Entry < Class < ? extends Option < ? , ? > > , ValueContainerBuilder < ? , ? > > entry : container . optionValues . entrySet ( ) ) { addAll ( entry . getKey ( ) , entry . getValue ( ) . build ( ) ) ; } } | Adds all options from the passed container to this container . |
23,993 | private static IndexedTypeSet toRootEntities ( ExtendedSearchIntegrator extendedIntegrator , Class < ? > ... selection ) { Set < Class < ? > > entities = new HashSet < Class < ? > > ( ) ; for ( Class < ? > entityType : selection ) { IndexedTypeSet targetedClasses = extendedIntegrator . getIndexedTypesPolymorphic ( Inde... | From the set of classes a new set is built containing all indexed subclasses but removing then all subtypes of indexed entities . |
23,994 | private void updateHostingEntityIfRequired ( ) { if ( hostingEntity != null && hostingEntityRequiresReadAfterUpdate ( ) ) { OgmEntityPersister entityPersister = getHostingEntityPersister ( ) ; if ( GridDialects . hasFacet ( gridDialect , GroupingByEntityDialect . class ) ) { ( ( GroupingByEntityDialect ) gridDialect ) ... | Reads the entity hosting the association from the datastore and applies any property changes from the server side . |
23,995 | private static List < Class < ? > > getClassHierarchy ( Class < ? > clazz ) { List < Class < ? > > hierarchy = new ArrayList < Class < ? > > ( 4 ) ; for ( Class < ? > current = clazz ; current != null ; current = current . getSuperclass ( ) ) { hierarchy . add ( current ) ; } return hierarchy ; } | Returns the class hierarchy of the given type from bottom to top starting with the given class itself . Interfaces are not included . |
23,996 | public static PersistenceStrategy < ? , ? , ? > getInstance ( CacheMappingType cacheMapping , EmbeddedCacheManager externalCacheManager , URL configurationUrl , JtaPlatform jtaPlatform , Set < EntityKeyMetadata > entityTypes , Set < AssociationKeyMetadata > associationTypes , Set < IdSourceKeyMetadata > idSourceTypes )... | Returns a persistence strategy based on the passed configuration . |
23,997 | private Iterable < PersistentNoSqlIdentifierGenerator > getPersistentGenerators ( ) { Map < String , EntityPersister > entityPersisters = factory . getMetamodel ( ) . entityPersisters ( ) ; Set < PersistentNoSqlIdentifierGenerator > persistentGenerators = new HashSet < PersistentNoSqlIdentifierGenerator > ( entityPersi... | Returns all the persistent id generators which potentially require the creation of an object in the schema . |
23,998 | public Relationship createRelationshipForEmbeddedAssociation ( GraphDatabaseService executionEngine , AssociationKey associationKey , EntityKey embeddedKey ) { String query = initCreateEmbeddedAssociationQuery ( associationKey , embeddedKey ) ; Object [ ] queryValues = createRelationshipForEmbeddedQueryValues ( associa... | Give an embedded association creates all the nodes and relationships required to represent it . It assumes that the entity node containing the association already exists in the db . |
23,999 | private RowKeyAndTuple createAndPutAssociationRowForInsert ( Serializable key , PersistentCollection collection , AssociationPersister associationPersister , SharedSessionContractImplementor session , int i , Object entry ) { RowKeyBuilder rowKeyBuilder = initializeRowKeyBuilder ( ) ; Tuple associationRow = new Tuple (... | Creates an association row representing the given entry and adds it to the association managed by the given persister . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.