public class EmbeddedNeo4jDialect extends BaseNeo4jDialect<org.hibernate.ogm.datastore.neo4j.embedded.dialect.impl.EmbeddedNeo4jEntityQueries,org.hibernate.ogm.datastore.neo4j.embedded.dialect.impl.EmbeddedNeo4jAssociationQueries>
A Tuple
is saved as a Node
where the columns are converted into properties of the node.
An Association
is converted into a Relationship
identified by the AssociationKey
and the
RowKey
. The type of the relationship is the value returned by
AssociationKeyMetadata.getCollectionRole()
.
If the value of a property is set to null the property will be removed (Neo4j does not allow to store null values).
CONSTRAINT_VIOLATION_CODE, TUPLE_ALREADY_EXISTS_EXCEPTION_PATTERN
Constructor and Description |
---|
EmbeddedNeo4jDialect(org.hibernate.ogm.datastore.neo4j.embedded.impl.EmbeddedNeo4jDatastoreProvider provider) |
Modifier and Type | Method and Description |
---|---|
protected org.hibernate.ogm.datastore.neo4j.embedded.dialect.impl.EmbeddedNeo4jAssociationQueries |
createNeo4jAssociationQueries(EntityKeyMetadata ownerEntityKeyMetadata,
AssociationKeyMetadata associationKeyMetadata) |
protected org.hibernate.ogm.datastore.neo4j.embedded.dialect.impl.EmbeddedNeo4jEntityQueries |
createNeo4jEntityQueries(EntityKeyMetadata entityKeyMetadata,
TupleTypeContext tupleTypeContext) |
Tuple |
createTuple(EntityKey key,
OperationContext tupleContext)
Creates a new tuple for the given entity key.
|
protected EntityKeyMetadata |
entityKeyMetadata(EntityKeyMetadata keyMetadata,
TupleTypeContext tupleTypeContext) |
ClosableIterator<Tuple> |
executeBackendQuery(BackendQuery<String> backendQuery,
QueryParameters queryParameters,
TupleContext tupleContext)
Returns the result of a native query executed on the backend.
|
int |
executeBackendUpdateQuery(BackendQuery<String> backendQuery,
QueryParameters queryParameters,
TupleContext tupleContext)
Returns the result of a native update query executed on the backend.
|
void |
forEachTuple(ModelConsumer consumer,
TupleTypeContext tupleTypeContext,
EntityKeyMetadata entityKeyMetadata)
A consumer is called for each tuple matching the selected
EntityKeyMetadata . |
Association |
getAssociation(AssociationKey associationKey,
AssociationContext associationContext)
Return the list of tuples corresponding to a given association and the given context
|
Tuple |
getTuple(EntityKey key,
OperationContext context)
Return the tuple with the given column for a given key
|
List<Tuple> |
getTuples(EntityKey[] keys,
TupleContext tupleContext)
Return the list of tuples with the given columns for a given list of keys.
|
void |
insertOrUpdateAssociation(AssociationKey key,
Association association,
AssociationContext associationContext)
Inserts or updates the given association in the datastore.
|
void |
insertOrUpdateTuple(EntityKey key,
org.hibernate.ogm.entityentry.impl.TuplePointer tuplePointer,
TupleContext tupleContext)
Inserts or updates the tuple corresponding to the given entity key.
|
Number |
nextValue(NextValueRequest request)
Returns the next value from the specified id generator with the specified increment.
|
String |
parseNativeQuery(String nativeQuery)
Parses the given native query into a representation executable by this dialect.
|
void |
removeAssociation(AssociationKey key,
AssociationContext associationContext)
Remove the list of tuples corresponding to a given association
|
void |
removeTuple(EntityKey key,
TupleContext tupleContext)
Remove the tuple for a given key
|
buildNativeQuery, convert, createAssociation, entityKeyMetadata, getAssociationQueries, getDuplicateInsertPreventionStrategy, getEntityKey, getEntityQueries, getEntityQueries, getParameterMetadataBuilder, getParameters, getServiceRegistry, initializeAssociationQueries, injectServices, isPartOfRegularEmbedded, isStoredInEntityStructure, overrideType, sessionFactoryCreated, supportsSequences, usesNavigationalInformationForInverseSideOfAssociations
getLockingStrategy, isInTheInsertionQueue
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getLockingStrategy
public EmbeddedNeo4jDialect(org.hibernate.ogm.datastore.neo4j.embedded.impl.EmbeddedNeo4jDatastoreProvider provider)
protected org.hibernate.ogm.datastore.neo4j.embedded.dialect.impl.EmbeddedNeo4jAssociationQueries createNeo4jAssociationQueries(EntityKeyMetadata ownerEntityKeyMetadata, AssociationKeyMetadata associationKeyMetadata)
protected org.hibernate.ogm.datastore.neo4j.embedded.dialect.impl.EmbeddedNeo4jEntityQueries createNeo4jEntityQueries(EntityKeyMetadata entityKeyMetadata, TupleTypeContext tupleTypeContext)
public Tuple getTuple(EntityKey key, OperationContext context)
GridDialect
key
- The tuple identifiercontext
- Contains additional information that might be used to create the tuplepublic List<Tuple> getTuples(EntityKey[] keys, TupleContext tupleContext)
MultigetGridDialect
All the keys provided will have the same EntityKeyMetadata
.
In other words they target the same "table".
keys
- The array of tuple identifiertupleContext
- Contains additional information that might be used to create the tuplespublic Tuple createTuple(EntityKey key, OperationContext tupleContext)
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 GridDialect
createTuple
in class BaseNeo4jDialect<org.hibernate.ogm.datastore.neo4j.embedded.dialect.impl.EmbeddedNeo4jEntityQueries,org.hibernate.ogm.datastore.neo4j.embedded.dialect.impl.EmbeddedNeo4jAssociationQueries>
key
- The tuple identifiertupleContext
- Contains additional information that might be used to create the tuplepublic void insertOrUpdateTuple(EntityKey key, org.hibernate.ogm.entityentry.impl.TuplePointer tuplePointer, TupleContext tupleContext)
GridDialect
key
- The tuple identifiertuplePointer
- A pointer to the list of operations to executetupleContext
- Contains additional information that might be used to create or update the tuplepublic void removeTuple(EntityKey key, TupleContext tupleContext)
GridDialect
key
- The tuple identifiertupleContext
- Contains additional information that might be used to remove the tupleprotected EntityKeyMetadata entityKeyMetadata(EntityKeyMetadata keyMetadata, TupleTypeContext tupleTypeContext)
public Association getAssociation(AssociationKey associationKey, AssociationContext associationContext)
GridDialect
associationKey
- Identifies the associationassociationContext
- Contains additional information that might be used to get the associationpublic void insertOrUpdateAssociation(AssociationKey key, Association association, AssociationContext associationContext)
GridDialect
key
- Identifies the associationassociation
- The list of operations to executeassociationContext
- Contains additional information that might be used to create the associationpublic void removeAssociation(AssociationKey key, AssociationContext associationContext)
GridDialect
key
- Identifies the associationassociationContext
- Contains additional information that might be used to remove an associationpublic void forEachTuple(ModelConsumer consumer, TupleTypeContext tupleTypeContext, EntityKeyMetadata entityKeyMetadata)
GridDialect
EntityKeyMetadata
. The tuples must be of the
same indexed type.consumer
- the instance that is going to be called for every Tuple
tupleTypeContext
- contains additional information that might be used to build the tupleentityKeyMetadata
- the key metadata of the table for which we want to apply the consumerpublic Number nextValue(NextValueRequest request)
GridDialect
request
- Identifies a specific id generatorpublic ClosableIterator<Tuple> executeBackendQuery(BackendQuery<String> backendQuery, QueryParameters queryParameters, TupleContext tupleContext)
QueryableGridDialect
backendQuery
- 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 contextClosableIterator
with the result of the querypublic int executeBackendUpdateQuery(BackendQuery<String> backendQuery, QueryParameters queryParameters, TupleContext tupleContext)
QueryableGridDialect
Precise 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>
executeBackendUpdateQuery
in class BaseNeo4jDialect<org.hibernate.ogm.datastore.neo4j.embedded.dialect.impl.EmbeddedNeo4jEntityQueries,org.hibernate.ogm.datastore.neo4j.embedded.dialect.impl.EmbeddedNeo4jAssociationQueries>
backendQuery
- 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 contextpublic String parseNativeQuery(String nativeQuery)
QueryableGridDialect
parseNativeQuery
in interface QueryableGridDialect<String>
parseNativeQuery
in class BaseNeo4jDialect<org.hibernate.ogm.datastore.neo4j.embedded.dialect.impl.EmbeddedNeo4jEntityQueries,org.hibernate.ogm.datastore.neo4j.embedded.dialect.impl.EmbeddedNeo4jAssociationQueries>
nativeQuery
- the native query to parseCopyright © 2010-2018 Red Hat, Inc. and others. Licensed under the GNU Lesser General Public License (LGPL), version 2.1 or later.