Giter VIP home page Giter VIP logo

gorm-hibernate4's Introduction

gorm-hibernate4's People

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

gorm-hibernate4's Issues

Grails2.4.4: Building criteria with ConversionService

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

Grails2 version of plugin is using wrong the version of datastore-gorm-support

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

flush.mode is not set in Hibernate

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 
    ....
}

JDK crash

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)

hs_err_pid20071.log
testHibernate4.zip

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.