Integrate Hibernate 5.2 with Spring framework 4.x

后端 未结 3 462
孤城傲影
孤城傲影 2020-12-03 05:09

I am using latest stable Spring version (4.2.6.RELEASE).

After upgrading Hibernate from 5.1 to 5.2 and changing hibernate-entitymanager dep

相关标签:
3条回答
  • 2020-12-03 05:28

    The issue is related to the versions only. Use Hibernate version 5.1.0 with Spring 4.3.7. It will solve this issue.
    Add the below dependency along with Spring framework dependencies of version 4.3.x .

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-entitymanager</artifactId>
        <version>5.1.0.Final</version>
    </dependency>`
    
    0 讨论(0)
  • 2020-12-03 05:45

    methods are

    applyFlushModeHint

    protected boolean applyFlushModeHint(FlushMode flushMode)
    
    Apply the FlushMode hint.
    
    Parameters:
        flushMode - The FlushMode value specified as hint
    Returns:
        true if the hint was "applied"
    

    Where FlushMode can be

    ALWAYS The Session is flushed before every query.
    AUTO The Session is sometimes flushed before query execution in order to ensure that queries never return stale state.
    COMMIT The Session is flushed when Transaction.commit() is called.
    MANUAL The Session is only ever flushed when Session.flush() is explicitly called by the application.
    NEVER Deprecated. use MANUAL instead.

    0 讨论(0)
  • 2020-12-03 05:50

    Hibernate 5.2 supports added in Spring framework 4.3 , that its stable version will be available in next week. Spring 4.2 only supports Hibernate up to 5.1.

    see this:

    https://jira.spring.io/browse/SPR-14334

    0 讨论(0)
提交回复
热议问题