[hibernate-dev] HHH-12372 Restore binary compatibility with applications using the legacy Session#getFlushMode() method

Sanne Grinovero sanne at hibernate.org
Thu Mar 8 06:17:48 EST 2018


On 8 March 2018 at 02:44, Steve Ebersole <steve at hibernate.org> wrote:
>
>
> On Wed, Mar 7, 2018 at 6:59 PM Sanne Grinovero <sanne at hibernate.org> wrote:
>>
>> Hi all,
>>
>> good news on the backwards compatibility; David suggested we could use
>> his "bridger" tool to have the Session API binary compatible with
>> older versions.
>>  - https://github.com/dmlloyd/bridger
>
>
> Wow, very cool!  Thanks for the tool David!
>
>
>> I had more trouble testing it.
>> Here a failed approach: I could not get Gradle to compile with a
>> different version used for testing, while at the same time not driving
>> dependencies in my IDE nuts :)
>>  -
>> https://github.com/Sanne/hibernate-orm/commit/28f5110cf9ccee9614bceb454036d5204cf9ff6f
>>
>
> You mean compile tests using the current project version but run tests
> against an older version?  If so, by far the easiest option will be a
> separate sourceSet.  Here you can use the project dependency in testCompile
> and the older version in testRuntime.
>
> If that's not what you mean, can you explain some more?

Thanks for the suggestions Steve. I got it working now but used a new
project module, which I named "compatibility-testing".
Ok to introduce that?

It just has some tests using the (legacy) getFlushMode(), and
dependencies setup as:

dependencies {
    // [!] Compile with Hibernate ORM 5.1, but then run the tests with
the current version
    testCompileOnly "org.hibernate:hibernate-core:5.1.12.Final"
    testCompileOnly "org.hibernate:hibernate-testing:5.1.12.Final"
    testRuntimeOnly project( ':hibernate-core' )
    testRuntimeOnly project( ':hibernate-testing' )
}

For some reason both Eclipse and IDEA get confused and the code shows
as not compiling; it works fine via Gradle though so I'm afraid we'll
just have to ignore the IDE warnings.
I'll experiment a bit more with sourceSet to see if we can avoid that
as it seems very inconvenient; Andrea will be with me this afternoon
so maybe he can have a look too.

Thanks,
Sanne


More information about the hibernate-dev mailing list