grails / gorm-redis Goto Github PK
View Code? Open in Web Editor NEWGORM for Redis
License: Apache License 2.0
GORM for Redis
License: Apache License 2.0
The monolithic grails project has been broken up into several smaller projects. Visit http://github.com/grails.
gradle3.5
dependencies {
compile 'org.grails.plugins:redis-gorm:6.0.4'
}
domain
class Person {
String firstName
String lastName
static constraints = {
firstName blank:false
lastName blank:false
}
static mapWith = "redis"
static mapping = {
lastName index:true
}
problem:
FAILURE: Build failed with an exception.
org.grails.datastore.gorm.redis.RedisEntityTraitProvider.isAvailable()Z
When i run my application to monitor a particular domain i get a
Caused by: java.lang.ClassNotFoundException: org.grails.datastore.gorm.bean.factory.AbstractMappingContextFactoryBean at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
My domain
class Book {
Long id
String title
Date releaseDate
static constraints = {
}
static mapping = {
title index:true
}
static mapWith = "redis"
}
My application.yml
host: "localhost"
port: 6379
# password: "secret"
pooled: true
resources: 15
timeout: 5000
This issue occures both on the
implementation 'org.grails.plugins:redis-gorm:5.0.13'
and
implementation 'org.grails.plugins:redis-gorm:6.0.4'
Reproduced with a sample application.
When I create a new GORM instance and call save()
, the expected behavior is for the data to be written when the session is flushed automatically.
What appears to be happening is that the insert never happens completely, though redis-cli monitor prints
1490915589.935292 [0 127.0.0.1:49638] "INCR" "gorm.redis.test.Book.next_id"
When I change it to save(flush: true)
, the data persists as expected.
While I understand 100% GORM-hibernate compatibility is not the goal, I would expect that calling save()
would still allow the underlying implementation to handle flushing the session for me.
Example project:
https://github.com/joemccall86/gorm-redis-test
Instructions: Run the grails app, and use cURL according to the following examples:
# Using hibernate
[~/code/gorm-redis-test]$ curl http://localhost:8080/book/save
saved%
[~/code/gorm-redis-test]$ curl http://localhost:8080/book/index
Author: John Doe, Pages: 300
1 books total
# Using mapWith="redis"
[~/code/gorm-redis-test]$ curl http://localhost:8080/book/save
saved%
[~/code/gorm-redis-test]$ curl http://localhost:8080/book/index
0 books total
Tested with "org.grails.plugins:redis-gorm:6.0.4"
and gormVersion=6.1.0.RELEASE
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.