Cross store experiments

Posted by Jan Machacek

Find me on:

05-Apr-2012 09:38:09

Just a quick post about what I'm thinking of hacking together: cross-store persistence between the Spring Data providers. What I would like to have is this:

@NodeEntity
case class User @PersistenceConstructor() (@GraphId id: java.lang.Long,
                                           @Indexed username: String) {

  @RelatedDocument
  var picture: Attachment = _
}

Notice the @RelatedDocument annotation on a Neo4j @NodeEntity. What I would love to implement is something similar to Spring Data's cross store persistence. You see, at the moment, you can have Neo4j/MongoDB/... instances "attached" to entities in JPA. What I struggled to find is how to have Neo4j @NodeEntity whose portions are stored in, say, MongoDB. Naturally, I would also like to have the inverse: have MongoDB cross-persist Neo4j entities:

@Document
case class UserDetails @PersistenceConstructor() (@Id id: String,
                                                  @Field address: String,
                                                  @Field ...) {
  @RelatedNode
  var user: User = _
}

I am not sure whether the whole thing is a good idea, but I shall report back here once I've done a good day's work!

Subscribe to Email Updates