Search in sources :

Example 1 with AbstractTransaction

use of org.neo4j.ogm.transaction.AbstractTransaction in project neo4j-ogm by neo4j.

the class RequestExecutor method initialiseNewEntity.

/**
 * Register entities in the {@link MappingContext}
 *
 * @param persisted entity created as part of the request
 */
private void initialiseNewEntity(Long identity, Object persisted) {
    MappingContext mappingContext = session.context();
    Transaction tx = session.getTransaction();
    if (persisted != null) {
        // it will be null if the variable represents a simple relationship.
        // set the id field of the newly created domain object
        EntityUtils.setIdentity(persisted, identity, session.metaData());
        ClassInfo classInfo = session.metaData().classInfo(persisted);
        if (tx != null) {
            ((AbstractTransaction) tx).registerNew(persisted);
        }
        registerEntity(mappingContext, classInfo, identity, persisted);
    }
}
Also used : MappingContext(org.neo4j.ogm.context.MappingContext) AbstractTransaction(org.neo4j.ogm.transaction.AbstractTransaction) Transaction(org.neo4j.ogm.transaction.Transaction) AbstractTransaction(org.neo4j.ogm.transaction.AbstractTransaction) ClassInfo(org.neo4j.ogm.metadata.ClassInfo)

Aggregations

MappingContext (org.neo4j.ogm.context.MappingContext)1 ClassInfo (org.neo4j.ogm.metadata.ClassInfo)1 AbstractTransaction (org.neo4j.ogm.transaction.AbstractTransaction)1 Transaction (org.neo4j.ogm.transaction.Transaction)1