I've set up a cross-store entity, but keep getting an error (stacktrace below). After debugging, it appears that the jpa portion of the entity has not saved prior to the flush() operation. I'm using a spring-configured repository and assumed that the neo4j repository extension would automatically wire in a repository that knows how to save both parts of the cross-store entity.

Then I noticed in the myrestaurants-social example project that the repository for the cross-store entity (UserAccount) wires in its own EntityManager and manually performs load and persist operations. Did I assume too much? Are there plans to create a repository factory bean that would seamlessly bridge the two worlds?

Thanks,
Eric

Code:
Caused by: java.lang.IllegalStateException: Flushing detached entity without a persistent state, this had to be created first.
	at org.springframework.data.neo4j.fieldaccess.DetachedEntityState.flushDirty(DetachedEntityState.java:182)
	at org.springframework.data.neo4j.fieldaccess.DetachedEntityState.persist(DetachedEntityState.java:267)
	at org.springframework.data.neo4j.aspects.support.node.Neo4jNodeBacking.ajc$interMethod$org_springframework_data_neo4j_aspects_support_node_Neo4jNodeBacking$org_springframework_data_neo4j_aspects_core_NodeBacked$persist(Neo4jNodeBacking.aj:133)
	at com.infusionsoft.schema.custom.entity.CrossEntity.persist(CrossEntity.java:1)
	at com.infusionsoft.schema.custom.entity.CrossEntity.persist(CrossEntity.java:1)
	at org.springframework.data.neo4j.support.mapping.Neo4jEntityPersister.persist(Neo4jEntityPersister.java:229)
	at org.springframework.data.neo4j.support.Neo4jTemplate.save(Neo4jTemplate.java:293)
	at org.springframework.data.neo4j.support.Neo4jTemplate.save(Neo4jTemplate.java:287)
	at org.springframework.data.neo4j.repository.AbstractGraphRepository.save(AbstractGraphRepository.java:108)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.executeMethodOn(RepositoryFactorySupport.java:334)
	at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:319)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
	at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:155)
Code:
<neo4j:config graphDatabaseService="graphDatabaseService" entityManagerFactory="entityManagerFactory"/>
<neo4j:repositories base-package="com.infusionsoft.**.graphrepo"/>
Code:
@Entity
@NodeEntity(partial = true)
public class CrossEntity implements Serializable {

    @Id
    @GeneratedValue
    @Column
    private Long id;

    @Column
    private String name;

    @Column
    private long age;

    
    @GraphProperty
    @Indexed
    private String foo;

    public String getFoo() {
        return foo;
    }

    public void setFoo(String foo) {
        this.foo = foo;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public long getAge() {
        return age;
    }

    public void setAge(long age) {
        this.age = age;
    }

}
Code:
//I've tried extending GraphRepository, as well as both CrudRepository AND GraphRepository
public interface CrossEntityRepository extends CrudRepository<CrossEntity, Long> {

}
Code:
@Test
    public void testCrossEntity() {
        CrossEntity crossEntity = new CrossEntity();
        crossEntity.setAge(12);
        crossEntity.setName("Billy");
        crossEntity.setFoo("Bar");
        crossEntity.setProperty("roger", "waters");
        crossEntity.setProperty("kidsBDay", new Date());

        //This line is where i get an error
        crossEntity = crossEntityService.save(crossEntity);
        
    }