1

I am trying to create a data access layer where an application would like to use both a traditional SQL store as well as a NoSQL store. After few searches, I have found a concept like Spring Data MongoDB cross strore and this concept similar to my requirement. So that, I have successfully configured as suggested in the reference document https://stackoverflow.com/a/13998825.

But I am getting below error when I test the above sample. Can some one please help in this regard...

Error: Caused by: org.hibernate.MappingException: Could not determine type for: com.hcc.riab.model.ProductInfo, at table: Product, for columns: [org.hibernate.mapping.Column(productInfo)]

Community
  • 1
  • 1
sgelle
  • 53
  • 1
  • 2
  • 10
  • Check out the [latest Spring Data MongoDB documentation](http://docs.spring.io/spring-data/mongodb/docs/current/reference/html/#mongo.cross.store) and try the example given therein. Then modify the example as per your needs. – manish Sep 09 '15 at 09:33
  • I have seen this documentation and it seems quite old. Example, the class MongoDocumentBacking is moved into another package ie., org.springframework.data.mongodb.crossstore.MongoDocumentBacking. I am little bit confusing which is latest the one. – sgelle Sep 09 '15 at 11:03
  • Error: Caused by: java.lang.ClassNotFoundException: org.springframework.data.persistence.document.mongo.MongoDocumentBacking – sgelle Sep 09 '15 at 11:14
  • See the [latest test cases](https://github.com/spring-projects/spring-data-mongodb/tree/master/spring-data-mongodb-cross-store/src/test) in the official code repository. – manish Sep 09 '15 at 11:50
  • @manish, thanks for your help. Still am getting same error which I posted in the question. Is there any way to solve my problem? – sgelle Sep 10 '15 at 07:36
  • I have checked out the samples and they work fine on my machine. Can you post your sample app somewhere so that someone can examine it? – manish Sep 10 '15 at 09:08
  • I have copied my source code @ [link](https://github.com/sgelle2280/spring-mongodb-crossstore.git). Could you please examine if your time permits. Thanks in advance. – sgelle Sep 10 '15 at 10:01
  • This is way too much code to debug and mixes unwanted Spring modules (e.g. MVC). Reduce it to the smallest possible code (one JPA managed entity and one MongoDB managed entity). – manish Sep 10 '15 at 13:48
  • I have created a small sample based on the official documentation that you can [access on Github](https://github.com/manish-in-java/spring-jpa-mongodb). The official documentation [has a known bug](https://jira.spring.io/browse/DATAMONGO-1103) and I have found [a new one in the cross-store module](https://jira.spring.io/browse/DATAMONGO-1285). You can monitor these to get the sample to work fully as expected. – manish Sep 11 '15 at 05:29
  • Does this sample requires any database dump? Because I am getting error saying that testFindAll(org.example.data.jpa.CustomerRepositoryTest) Time elapsed: 0.502 sec <<< FAILURE! java.lang.AssertionError at org.junit.Assert.fail(Assert.java:86) at org.junit.Assert.assertTrue(Assert.java:41) at org.junit.Assert.assertNotNull(Assert.java:712) at org.junit.Assert.assertNotNull(Assert.java:722) at org.example.data.jpa.CustomerRepositoryTest.lambda$0(CustomerRepositoryTest.java:63) – sgelle Sep 11 '15 at 06:04
  • No database dump is required, the tests generate their own data. The error you see is due to one of the test cases failing. This is the bug I mentioned earlier. – manish Sep 11 '15 at 11:19
  • Thanks your support..:) I have mentioned the same in my design document. – sgelle Sep 11 '15 at 16:16

0 Answers0