-
Notifications
You must be signed in to change notification settings - Fork 681
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Upgrade hibernate #1114
Upgrade hibernate #1114
Conversation
hi @asolntsev, Does the patch file (https://github.com/playframework/play1/blob/master/framework/patches/hibernate-4.2.19-patch-play.patch.patch) still need to be applied to the new version of Hibernate? cheers |
@tazmaniax Thank you for the hint! Actually I don't know an answer. Can you help me: do you know why this hack was needed? |
@tazmaniax I tried this patch, and it helped. P.S. There is still a question in the air: why this hack was needed? Why does Play framework use such hidden unobvious hacks? |
@asolntsev The hibernate patch is part of the code base for a long time. Play! 1 started with hibernate from Version 3. There was a time when the hibernate3xxx.jar has been distrubuted as patched wihtout the patch source (that was really hidden). Here just the essential hint of what was changed for Play!:
Maybe it is a good time to enhence the JPA documentation to make an association to that patch (that is really missing for someone who wants to upgrade hibernate version). |
01079bf
to
2d7a806
Compare
@flybyray Thank you for clarification. I like the idea of maintaining object state manually and calling And I wonder: is it real that nobody but Play needs to disable dirty check in Hibernate? Probably there is a more common solution for this problem? P.S. I created a simpler solution: I renamed |
@xael-fry @tazmaniax @flybyray Yihhaaaa!!! This day came! Can you review the changes and merge the pull request? |
From my point of view looking the github pull request diff it is ok: But I have the feeling that something is wrong with github pull request comparison. Github shows me 38 Files changed. But if i check the pull request locally there are more changes, which are missing or filtered by github pull request api. $ git config --get-regexp remote.*.url
remote.origin.url git@github.com:playframework/play1.git
remote.codeborne.url git@github.com:codeborne/play.git
$ git for-each-ref --sort=-committerdate refs/heads/
58c870efea9532b0e84edbb7828e578d374c999b commit refs/heads/master
b128c17f0d34ef15dc3d94acbd83a0cdfef5feb6 commit refs/heads/upgrade-hibernate
b128c17f0d34ef15dc3d94acbd83a0cdfef5feb6 commit refs/heads/pull1114
$ git status
Auf Branch master
Ihr Branch ist auf dem selben Stand wie 'origin/master'.
$ git diff refs/heads/pull1114 --name-only | wc -l
110 The pull request has 110 files changed. Some file changes are less important, maybe github filtered them out. But those changes, changed/removed javadoc, reorganized import statements ... Maybe it would be better to have a single commit pull request. Maybe github has some problems with multiple commits including hugh binaries. The patch is really big because of binaries https://github.com/playframework/play1/pull/1114.patch I was somehow surprised that the hibernate patch does not need any modification at all for the upgrade from 4 to 5. Maybe I should check that in detail? Did you run the hibernate tests itself (yes some will be failing in local environment, round about 2 or 4 tests failed for hibernate 4)? --- UPDATE --- $ git diff refs/heads/pull1114 --name-only | wc -l
39 |
@flybyray I did |
@asolntsev no is all ok, but maybe fix the line endings in |
@flybyray done (removed file endings) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a lot of warning when running in test mode.
We need to investigate.
Don't forget to put issue number in commit message
11:58:08,287 INFO ~ Connected to jdbc:h2:mem:play;MODE=PostgreSQL;LOCK_MODE=0;MV_STORE=FALSE;MVCC=FALSE; for default
11:58:08,352 DEBUG ~ Logging Provider: org.jboss.logging.Log4jLoggerProvider
11:58:10,059 WARN ~ GenerationTarget encountered exception accepting command : Error executing DDL via JDBC Statement
org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL via JDBC Statement
at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:67)
at org.hibernate.tool.schema.internal.SchemaDropperImpl.applySqlString(SchemaDropperImpl.java:375)
at org.hibernate.tool.schema.internal.SchemaDropperImpl.applySqlStrings(SchemaDropperImpl.java:359)
at org.hibernate.tool.schema.internal.SchemaDropperImpl.applyConstraintDropping(SchemaDropperImpl.java:331)
at org.hibernate.tool.schema.internal.SchemaDropperImpl.dropFromMetadata(SchemaDropperImpl.java:230)
at org.hibernate.tool.schema.internal.SchemaDropperImpl.performDrop(SchemaDropperImpl.java:154)
at org.hibernate.tool.schema.internal.SchemaDropperImpl.doDrop(SchemaDropperImpl.java:126)
at org.hibernate.tool.schema.internal.SchemaDropperImpl.doDrop(SchemaDropperImpl.java:112)
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:144)
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:72)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:309)
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:452)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:889)
at play.db.jpa.JPAPlugin.newEntityManagerFactory(JPAPlugin.java:183)
at play.db.jpa.JPAPlugin.onApplicationStart(JPAPlugin.java:130)
at play.plugins.PluginCollection.onApplicationStart(PluginCollection.java:616)
at play.Play.start(Play.java:541)
at play.Play.detectChanges(Play.java:659)
at play.Invoker$Invocation.init(Invoker.java:209)
at play.server.PlayHandler$NettyInvocation.init(PlayHandler.java:264)
at play.Invoker$Invocation.run(Invoker.java:295)
at play.server.PlayHandler$NettyInvocation.run(PlayHandler.java:303)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.h2.jdbc.JdbcSQLException: Table "API_CONSTRAINTS" not found; SQL statement:
alter table api_constraints drop constraint FKlxvisbtqofqx7kil2jrrqukvd [42102-193]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
at org.h2.message.DbException.get(DbException.java:179)
at org.h2.message.DbException.get(DbException.java:155)
at org.h2.command.Parser.tableIfTableExists(Parser.java:5673)
at org.h2.command.Parser.commandIfTableExists(Parser.java:5686)
at org.h2.command.Parser.parseAlterTable(Parser.java:5511)
at org.h2.command.Parser.parseAlter(Parser.java:4844)
at org.h2.command.Parser.parsePrepared(Parser.java:344)
at org.h2.command.Parser.parse(Parser.java:317)
at org.h2.command.Parser.parse(Parser.java:289)
at org.h2.command.Parser.prepareCommand(Parser.java:254)
at org.h2.engine.Session.prepareLocal(Session.java:561)
at org.h2.engine.Session.prepareCommand(Session.java:502)
at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1203)
at org.h2.jdbc.JdbcStatement.executeInternal(JdbcStatement.java:170)
at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:158)
at com.mchange.v2.c3p0.impl.NewProxyStatement.execute(NewProxyStatement.java:75)
at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:54)
@xael-fry I cannot reproduce your problem with warnings. Which application can I use to reproduce it? Which application contains |
7d015f8
to
329de2c
Compare
@asolntsev It is in my project it is just a simple, I will try to extract it for testing |
@asolntsev |
try to upgrade hibernate next try add missing dependency com.fasterxml -> classmate (used by hibernate 5) set datasource to hibernate fix dependencies.yml format upgrade hibernate-c3p0 dependency upgrade to hibernate 5.2.8 ApplicationClassloader can now find ".class" resources without this, Hibernate5 would not resolve programmatically added entity classes upgrade to hibernate 5.2.10 fix tests: use indexed placeholders for parameters use patched version of hibernate-core 5.2.10 fix test fix test add support for "jpa.mapping-file" setting rename to hibernate-core 5.2.10.patched
789ebdd
to
50f5b13
Compare
@xael-fry Thank you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the patch "hibernate-5.2.10-patch-play.patch" is not applyable to the hibernate-orm 5.2.10, at least the Interceptor.java needs changes
Maybe look at hibernate/hibernate-orm@master...flybyray:hibernate_5_2_10_patch_play to see what should be changed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The play models are collected into PersistenceUnitInfoImpl.managedClassNames.
but those will never get read by hibernate for now @see
https://github.com/hibernate/hibernate-orm/blob/b38a9f40ac2bc8ccf16b05af09cb96988ea93fb2/hibernate-core/src/main/java/org/hibernate/jpa/boot/internal/EntityManagerFactoryBuilderImpl.java#L715-L715
as i can see you should put them for now into configuration with key org.hibernate.jpa.AvailableSettings#LOADED_CLASSES
fix loaded entity classes in hibernate from #1114
See issue #1113
This pull request is not finally ready yet. I am sharing it just for your early reviews (if anybody is interested). I will continue working on it.