public abstract class BaseNeo4jDialect<E extends org.hibernate.ogm.datastore.neo4j.dialect.impl.BaseNeo4jEntityQueries,A extends org.hibernate.ogm.datastore.neo4j.dialect.impl.BaseNeo4jAssociationQueries> extends BaseGridDialect implements QueryableGridDialect<String>, ServiceRegistryAwareService, SessionFactoryLifecycleAwareDialect, MultigetGridDialect
| Modifier and Type | Field and Description |
|---|---|
static String |
CONSTRAINT_VIOLATION_CODE |
protected static Pattern |
TUPLE_ALREADY_EXISTS_EXCEPTION_PATTERN |
| Constructor and Description |
|---|
BaseNeo4jDialect(org.hibernate.ogm.datastore.neo4j.dialect.impl.BaseNeo4jTypeConverter converter) |
| Modifier and Type | Method and Description |
|---|---|
protected String |
buildNativeQuery(BackendQuery<String> customQuery,
QueryParameters queryParameters) |
protected RowKey |
convert(AssociationKey associationKey,
TupleSnapshot snapshot) |
Association |
createAssociation(AssociationKey associationKey,
AssociationContext associationContext)
Creates a new (empty) association for storing the tuples representing the rows corresponding to the given key.
|
protected abstract A |
createNeo4jAssociationQueries(EntityKeyMetadata ownerEntityKeyMetadata,
AssociationKeyMetadata associationKeyMetadata) |
protected abstract E |
createNeo4jEntityQueries(EntityKeyMetadata entityKeyMetadata,
TupleTypeContext tupleTypeContext) |
Tuple |
createTuple(EntityKey key,
OperationContext operationContext)
Creates a new tuple for the given entity key.
|
protected EntityKeyMetadata |
entityKeyMetadata(EntityKeyMetadata keyMetadata,
TupleTypeContext tupleTypeContext) |
protected EntityKeyMetadata |
entityKeyMetadata(org.hibernate.ogm.persister.impl.OgmEntityPersister ogmEntityPersister) |
int |
executeBackendUpdateQuery(BackendQuery<String> query,
QueryParameters queryParameters,
TupleContext tupleContext)
Returns the result of a native update query executed on the backend.
|
protected A |
getAssociationQueries(AssociationKeyMetadata associationKeyMetadata) |
DuplicateInsertPreventionStrategy |
getDuplicateInsertPreventionStrategy(EntityKeyMetadata entityKeyMetadata)
Returns this dialect's strategy for detecting the insertion of several entity tuples of the given type with the
same primary key.
|
protected EntityKey |
getEntityKey(Tuple tuple,
AssociatedEntityKeyMetadata associatedEntityKeyMetadata)
Returns the key of the entity targeted by the represented association, retrieved from the given tuple.
|
protected E |
getEntityQueries(EntityKeyMetadata entityKeyMetadata,
OperationContext operationContext) |
protected E |
getEntityQueries(EntityKeyMetadata entityKeyMetadata,
TupleTypeContext tupleTypeContext) |
ParameterMetadataBuilder |
getParameterMetadataBuilder()
Returns a builder for retrieving parameter meta-data from native queries in this datastore's format.
|
protected Map<String,Object> |
getParameters(QueryParameters queryParameters) |
ServiceRegistryImplementor |
getServiceRegistry() |
protected Map<AssociationKeyMetadata,A> |
initializeAssociationQueries(SessionFactoryImplementor sessionFactoryImplementor) |
void |
injectServices(ServiceRegistryImplementor serviceRegistry) |
static boolean |
isPartOfRegularEmbedded(String[] keyColumnNames,
String column)
A regular embedded is an element that it is embedded but it is not a key or a collection.
|
boolean |
isStoredInEntityStructure(AssociationKeyMetadata associationKeyMetadata,
AssociationTypeContext associationTypeContext)
Whether the specified association is stored within an entity structure or not.
|
GridType |
overrideType(Type type)
If the datastore does not support a
Type the dialect might override it with a custom one. |
String |
parseNativeQuery(String nativeQuery)
Parses the given native query into a representation executable by this dialect.
|
void |
sessionFactoryCreated(SessionFactoryImplementor sessionFactoryImplementor)
Injection point for the dialect to receive the session factory.
|
boolean |
supportsSequences()
Whether this dialect supports sequences for id generation or not.
|
boolean |
usesNavigationalInformationForInverseSideOfAssociations()
Whether this dialect uses navigational information to deal with the inverse side of an association.
|
getLockingStrategy, isInTheInsertionQueueclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitexecuteBackendQuerygetTuplesforEachTuple, getAssociation, getLockingStrategy, getTuple, insertOrUpdateAssociation, insertOrUpdateTuple, nextValue, removeAssociation, removeTuplepublic static final String CONSTRAINT_VIOLATION_CODE
protected static final Pattern TUPLE_ALREADY_EXISTS_EXCEPTION_PATTERN
public BaseNeo4jDialect(org.hibernate.ogm.datastore.neo4j.dialect.impl.BaseNeo4jTypeConverter converter)
public void sessionFactoryCreated(SessionFactoryImplementor sessionFactoryImplementor)
SessionFactoryLifecycleAwareDialectsessionFactoryCreated in interface SessionFactoryLifecycleAwareDialectsessionFactoryImplementor - a successfully created SessionFactoryImplementorprotected E getEntityQueries(EntityKeyMetadata entityKeyMetadata, OperationContext operationContext)
protected E getEntityQueries(EntityKeyMetadata entityKeyMetadata, TupleTypeContext tupleTypeContext)
protected A getAssociationQueries(AssociationKeyMetadata associationKeyMetadata)
public void injectServices(ServiceRegistryImplementor serviceRegistry)
injectServices in interface ServiceRegistryAwareServicepublic ServiceRegistryImplementor getServiceRegistry()
public Tuple createTuple(EntityKey key, OperationContext operationContext)
GridDialect
Only invoked if no tuple is present yet for the given key. Implementations should not perform a round-trip to the
datastore but rather return a transient instance. The OGM engine will invoke
GridDialect.insertOrUpdateTuple(EntityKey, TuplePointer, TupleContext) subsequently.
Columns in the tuple may represent properties of the corresponding entity as well as *-to-one associations to other entities. Implementations may choose to persist the latter e.g. in form of fields or as actual links/relationships to the element representing the associated entity. In case of multi-column keys, the corresponding association role for a given column can be obtained from the passed tuple context.
createTuple in interface GridDialectkey - The tuple identifieroperationContext - Contains additional information that might be used to create the tuplepublic Association createAssociation(AssociationKey associationKey, AssociationContext associationContext)
GridDialect
Only invoked if the association does not yet exist in the datastore. Implementations should not perform a
round-trip to the datastore but rather return a transient instance. The OGM engine will invoke
GridDialect.insertOrUpdateAssociation(AssociationKey, Association, AssociationContext) subsequently.
createAssociation in interface GridDialectassociationKey - Identifies the associationassociationContext - Contains additional information that might be used to create the associationpublic boolean isStoredInEntityStructure(AssociationKeyMetadata associationKeyMetadata, AssociationTypeContext associationTypeContext)
GridDialecttrue if this is the
case for a given association.isStoredInEntityStructure in interface GridDialectassociationKeyMetadata - identifies the association of interestassociationTypeContext - provides additional contextual information about the represented association type,
such as the options effectively applying for ittrue if the specified association is stored within an entity structure, false otherwise.public boolean supportsSequences()
GridDialectsupportsSequences in interface GridDialectsupportsSequences in class BaseGridDialecttrue if this dialect supports sequences, false otherwise.protected RowKey convert(AssociationKey associationKey, TupleSnapshot snapshot)
public GridType overrideType(Type type)
GridDialectType the dialect might override it with a custom one.overrideType in interface GridDialectoverrideType in class BaseGridDialecttype - The Type that might need to be overriddentype or null if the type does not need to be
overriddenpublic String parseNativeQuery(String nativeQuery)
QueryableGridDialectparseNativeQuery in interface QueryableGridDialect<String>nativeQuery - the native query to parseprotected String buildNativeQuery(BackendQuery<String> customQuery, QueryParameters queryParameters)
public ParameterMetadataBuilder getParameterMetadataBuilder()
QueryableGridDialectgetParameterMetadataBuilder in interface QueryableGridDialect<String>protected EntityKey getEntityKey(Tuple tuple, AssociatedEntityKeyMetadata associatedEntityKeyMetadata)
tuple - the tuple from which to retrieve the referenced entity keypublic DuplicateInsertPreventionStrategy getDuplicateInsertPreventionStrategy(EntityKeyMetadata entityKeyMetadata)
GridDialectgetDuplicateInsertPreventionStrategy in interface GridDialectgetDuplicateInsertPreventionStrategy in class BaseGridDialectentityKeyMetadata - meta-data identifying the entity type of interestpublic static boolean isPartOfRegularEmbedded(String[] keyColumnNames, String column)
keyColumnNames - the column names representing the identifier of the entitycolumn - the column we want to checktrue if the column represent an attribute of a regular embedded element, false otherwisepublic int executeBackendUpdateQuery(BackendQuery<String> query, QueryParameters queryParameters, TupleContext tupleContext)
QueryableGridDialectPrecise semantics of an update are subject to design choices made for the actual database system in the backend. In particular, it may implement non-classical notions of consistency such as eventual consistency (rather than (conflict) serializablity as in most relational SQL database systems).
executeBackendUpdateQuery in interface QueryableGridDialect<String>query - the query to execute in a representation understood by the underlying datastore. May have been
created by converting a JP-QL query or from a (named) native query.queryParameters - parameters passed for this querytupleContext - the tuple contextprotected Map<String,Object> getParameters(QueryParameters queryParameters)
public boolean usesNavigationalInformationForInverseSideOfAssociations()
GridDialectusesNavigationalInformationForInverseSideOfAssociations in interface GridDialectusesNavigationalInformationForInverseSideOfAssociations in class BaseGridDialecttrue is this dialect uses navigational information.protected EntityKeyMetadata entityKeyMetadata(org.hibernate.ogm.persister.impl.OgmEntityPersister ogmEntityPersister)
protected EntityKeyMetadata entityKeyMetadata(EntityKeyMetadata keyMetadata, TupleTypeContext tupleTypeContext)
protected abstract E createNeo4jEntityQueries(EntityKeyMetadata entityKeyMetadata, TupleTypeContext tupleTypeContext)
protected Map<AssociationKeyMetadata,A> initializeAssociationQueries(SessionFactoryImplementor sessionFactoryImplementor)
protected abstract A createNeo4jAssociationQueries(EntityKeyMetadata ownerEntityKeyMetadata, AssociationKeyMetadata associationKeyMetadata)
Copyright © 2010-2018 Red Hat, Inc. and others. Licensed under the GNU Lesser General Public License (LGPL), version 2.1 or later.