1

In Spring Roo when we enable our project for JPA using the following command:-

jpa setup --provider DATANUCLEUS --database 

Then I found that there is no option for MongoDB after --database option.So i want to know how can I do it.

I am thinking to create a JPA setup for MySql and then make changes in the generated persistence.xml for MongoDB cause at the end even ROO is a java project.But I don't know whether its the correct approach.

I would appreciate any assistance in doing this.Any link or example will be great.

4

3 回答 3

5

MongoDB 有一个类似的 Roo 命令:

roo> mongo setup

并创建实体:

roo> entity mongo --class ~.domain.Pizza

在此 URL 找到更多详细信息:http: //blog.springsource.org/2011/09/14/new-application-layering-and-persistence-choices-in-spring-roo/

于 2012-06-16T23:48:45.553 回答
1
mongo setup --databaseName personDB
entity mongo --class ~.model.Person --testAutomatically
field string --fieldName name --notNull
repository mongo --interface ~.repository.PersonRepository --entity ~.model.Person
于 2013-09-19T13:41:35.190 回答
0

无论数据存储如何,JPA 都是 JPA。只需将数据存储设置为“支持 Spring”的数据库,然后按照您的说法更新 persistence.xml。DataNucleus 对 MongoDB 的支持将忽略不适用于特定数据存储的注释(根据 DN 文档和支持的功能页面)

于 2012-06-14T07:53:54.047 回答