title: Trying to use Crate.io NoSql database with an existing Spring Data / Mysql project
body: <p>I'm attempting to add Crate.IO capability to an existing Spring Data/Eclipselink/MySql web application. For this specific use case, we want to persist data to both MySql AND Crate (for evaluation purposes) in the most painless way possible. I'm using the Spring-Data-Crate project in order to be able to use Spring Data Repositories with Crate. </p>
  
  <p>I've been able to setup a separate Crate specific entity manager with a filter to only utilize repos that implement CrateRepository. The problem I'm having is determining how to use the existing Spring Data/MySql entity classes with Crate. (or derive from them) </p>
  
  <p>1) If I annotate an existing Spring Data @Entity class with the Spring-Data-Crate
  @Table annotation, the mapping to the crate DB will fail <strong>because EclipseLink/JPA adds hidden persistence fields to entities objects that start with an underscore, which is apparently not allowed by the spring-data-crate adapter</strong></p>
  
  <p>2) I tried to use entity inheritance, with a base class that both the MySql and Crate entity can extend, with only the MySql entity having the spring data @Entity annotation. Unfortunately, this causes <strong>Spring Data to lose visibility of the base class fields unless the base class is annotated with @MappedSuperClass.</strong> But adding this annotation introduces the hidden "_"-prefixed persistence properties to the derived crate entity.</p>
  
  <p>3) I could use separate entities entirely and have them implement a common interface, but I can't assign the interface as the type of the spring data crate repository.</p>
  
  <p>... Not sure where to go from here</p>
  
  <p>Spring Data Crate adapter project - <a href="https://github.com/KPTechnologyLab/spring-data-crate" rel="nofollow">https://github.com/KPTechnologyLab/spring-data-crate</a>
  Spring Data Crate Tutorial - <a href="https://crate.io/a/using-sprint-data-crate-with-your-java-rest-application/" rel="nofollow">https://crate.io/a/using-sprint-data-crate-with-your-java-rest-application/</a></p>