grails / gorm-hibernate4 Goto Github PK
View Code? Open in Web Editor NEWGORM for Hibernate 4
License: Apache License 2.0
GORM for Hibernate 4
License: Apache License 2.0
The monolithic grails project has been broken up into several smaller projects. Visit http://github.com/grails.
I am trying to upgrade a grails project from 1.3.7 to 2.4.4. Along with this I also need to update grails-gorm 1.3.7 to grails-datastore-gorm-hibernate4 3.1.3.
In my existing code I am calling populateArgumentsForCriteria method of GrailsHibernateUtil class as:
GrailsHibernateUtil.populateArgumentsForCriteria(targetClass, criteria, (Map)args[0]);
The same wouldn't work with grails-datastore-gorm-hibernate4 3.1.3 as the method signatures are changed and I see a compilation error as:
The method populateArgumentsForCriteria(Criteria, Map, ConversionService) in the type GrailsHibernateUtil is not applicable for the arguments (Class, Criteria, Map)
I am not sure what ConversionService parameter I need to pass to populateArgumentsForCriteria method. Can anyone help please if you have seen this before?
Thanks
See the dependency report below,
+--- org.grails.plugins:hibernate4:6.0.0.BUILD-20160714.091558-53
| --- org.hibernate:hibernate-core:4.3.10.Final
| --- org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:1.0.0.Final
| --- dom4j:dom4j:1.6.1
| --- org.hibernate.common:hibernate-commons-annotations:4.0.5.Final
| --- antlr:antlr:2.7.7
| --- org.jboss:jandex:1.1.0.Final
| --- org.grails:grails-datastore-web:6.0.0.BUILD-20160726.182644-81
| --- org.springframework:spring-web:4.1.8.RELEASE
| --- org.grails:grails-datastore-gorm-support:6.0.0.BUILD-20160726.182538-82
| --- org.grails:grails-datastore-gorm-hibernate4:6.0.0.BUILD-20160726.184440-81
| --- javax.el:javax.el-api:2.2.4
| --- org.grails:grails-datastore-gorm-hibernate-core:6.0.0.BUILD-20160726.182453-86
| --- org.springframework:spring-orm:4.1.8.RELEASE
+
org.grails:grails-datastore-gorm-support:6.0.0.BUILD-20160726.182538-82
should have been
org.grails:grails-datastore-gorm-grails2-support:6.0.0.BUILD-20160726.182435-86
.
see the dependency report for neo4j plugin, which is correct
+--- org.grails.plugins:neo4j:6.0.0.BUILD-20160727.162632-100
| --- org.grails:grails-datastore-simple:6.0.0.BUILD-20160726.182639-81
| --- org.grails:grails-datastore-core:6.0.0.BUILD-20160726.182401-86
| --- javax.transaction:jta:1.1
| --- org.grails:grails-datastore-gorm:6.0.0.BUILD-20160726.182421-86
| --- org.grails:grails-datastore-async:6.0.0.BUILD-20160726.182342-43
| --- org.grails:grails-datastore-gorm-validation:6.0.0.BUILD-20160726.182623-74
| --- org.grails:grails-datastore-gorm-grails2-support:6.0.0.BUILD-20160726.182435-86
| --- org.grails:grails-datastore-gorm-neo4j:6.0.0.BUILD-20160727.162511-111
HHH-2763 has been fixed; the default AbstractFlushingEventListener borrowed the logic from Grails' PatchedDefaultFlushEventListener. The latter is therefore probably safe to remove.
The way flushMode
gets resolved in HibernateDatastoreSpringInitializer does not match with the way GrailsOpenSessionInViewInterceptor expects to set the FlushMode
. An easy fix would be to update below method to use AbstractHibernateDatastore.FlushMode
instead of GrailsHibernateTemplate
.
flushModes required in GrailsOpenSessionInViewInterceptor
MANUAL(0),
COMMIT(5),
AUTO(10),
ALWAYS(20)
flushModes provided by GrailsHibernateTemplate
:
public static final int FLUSH_NEVER = 0;
public static final int FLUSH_AUTO = 1;
public static final int FLUSH_EAGER = 2;
public static final int FLUSH_COMMIT = 3;
public static final int FLUSH_ALWAYS = 4;
Method in HibernateDatastoreSpringInitializer
that needs change:
@CompileStatic
private static int resolveDefaultFlushMode(CharSequence flushModeStr, boolean readOnly) {
int flushMode
if (Boolean.TRUE.equals(readOnly)) {
flushMode = GrailsHibernateTemplate.FLUSH_NEVER
}
else if (flushModeStr instanceof CharSequence) {
switch(flushModeStr.toString().toLowerCase()) {
case "manual":
case "never":
flushMode = GrailsHibernateTemplate.FLUSH_NEVER
break
case "always":
flushMode = GrailsHibernateTemplate.FLUSH_ALWAYS
break
case "commit":
flushMode = GrailsHibernateTemplate.FLUSH_COMMIT
break
default:
flushMode = GrailsHibernateTemplate.FLUSH_AUTO
}
}
else {
flushMode = GrailsHibernateTemplate.FLUSH_AUTO
}
return flushMode
}
Right now the work around is to use withSession
and manually setFlushMode
to whichever you want. For example:
Foo.withSession { session ->
session.flushMode = FlushMode.COMMIT
....
}
I'm having an issue using this library in a Grails 3.3.2 project.
It works fine in dev mode but when I try to create the war Gradle ends unexpectedly and a JDK threaddump file is generated.
I've created a new project to check if it was something caused by my project but it is reproduced.
I attach the project as well as the thread dump.
S.O: Ubuntu 17.10
JDK: 1.8.0_161 (tried several ones)
Grails: 3.3.2
Gradle: 4.4 (tried several ones)
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.