private boolean isIdentifierProperty(EntityIndexBinding entityIndexBinding, String... propertyPath) { return propertyPath.length == 1 && propertyPath[0].equals( entityIndexBinding.getDocumentBuilder().getIdPropertyName() ); }
/** * Returns a {@link Criterion} for fetching all the given entity infos. If needed, this criterion will contain a * {@link Disjunction} for fetching the infos in chunks of {@link CriteriaObjectInitializer#MAX_IN_CLAUSE} elements. */ private Criterion getIdListCriterion(List<EntityInfo> entityInfos, ObjectInitializationContext objectInitializationContext) { DocumentBuilderIndexedEntity documentBuilder = getDocumentBuilder( entityInfos.iterator().next().getType(), objectInitializationContext.getExtendedSearchIntegrator() ); String idName = documentBuilder.getIdPropertyName(); Disjunction disjunction = Restrictions.disjunction(); int maxResults = entityInfos.size(); int loop = maxResults / MAX_IN_CLAUSE; boolean exact = maxResults % MAX_IN_CLAUSE == 0; if ( !exact ) { loop++; } for ( int index = 0; index < loop; index++ ) { int max = Math.min( index * MAX_IN_CLAUSE + MAX_IN_CLAUSE, maxResults ); List<Serializable> ids = new ArrayList<>( max - index * MAX_IN_CLAUSE ); for ( int entityInfoIndex = index * MAX_IN_CLAUSE; entityInfoIndex < max; entityInfoIndex++ ) { ids.add( entityInfos.get( entityInfoIndex ).getId() ); } disjunction.add( Restrictions.in( idName, ids ) ); } return disjunction; }
this.idNameOfIndexedType = extendedIntegrator.getIndexBinding( type ) .getDocumentBuilder() .getIdPropertyName(); this.sessionFactory = sessionFactory;
return new EntityInfoImpl( typeId, documentBuilder.getIdPropertyName(), (Serializable) id, projections );
return new EntityInfoImpl( typeId, documentBuilder.getIdPropertyName(), (Serializable) id, projections );
String idName = documentBuilder.getIdPropertyName(); Serializable id = extractId( documentBuilder, document ); Object[] projected = null;
String idName = documentBuilder.getIdPropertyName(); Serializable id = extractId( documentBuilder, document ); Object[] projected = null;
private String idInString(ConversionContext conversionContext, Serializable id, IndexedTypeIdentifier typeIdentifier, DocumentBuilderIndexedEntity docBuilder) { conversionContext.pushProperty( docBuilder.getIdPropertyName() ); try { String idInString = conversionContext.setConvertedTypeId( typeIdentifier ).twoWayConversionContext( docBuilder.getIdBridge() ) .objectToString( id ); return idInString; } finally { conversionContext.popProperty(); } }
String idPropertyName = docBuilder.getIdPropertyName(); if ( idPropertyName != null ) { conversionContext.pushProperty( idPropertyName );