First, briefly describe the necessary scenarios in my project: Because the Shiro verification plug-in is used and some fixed domain, the domain object of Hibernate will be retained, however, in a specific domain, it is required that its fields be maintained. This is obviously not suitable for relational databases, but Mongodb can meet this requirement based on its Document.
Therefore, in such an application project, at least two plug-ins are required: Shiro and Mongodb. for basic usage, refer to the official documentation. Here we will briefly summarize several problems encountered in integration.
1. Domain id. Use ObjectId unless otherwise specified.
Java code
Import org. bson. types. ObjectId
Class DummyData {
Static mapWith = "mongo"
ObjectId id
}
2. Use the Service
Java code
Static transactional = 'mongo'
Otherwise, the database may not be stored.