New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LPS 128873 Hibernate 2022 3 17 #2191
Conversation
dantewang
commented
Mar 17, 2022
- LPS-149268 Inline org.hibernate.type.StringClobType and fix SF. This class is deprecated and removed in Hibernate 5, but migrating to the replacement will cause incompatibility with various database software and the databases created by previous Liferay versions.
- LPS-149268 Semantic Versioning
- LPS-128873 Migrate patched lib "spring-orm": check in original class
- LPS-128873 Migrate patched lib "spring-orm": apply LPS-100343 for the Hibernate 5 version of SpringSessionSynchronization
- LPS-128873 Migrate patched lib "spring-orm": FAKE GRADLE CACHE
- LPS-128873 Upgrade to Hibernate-core 5.6.3.Final with required dependencies
- LPS-128873 Auto SF
- LPS-128873 Build lib versions
- LPS-128873 Migrate custom types, we should implement UserType rather than CompositeUserType. CompositeUserType is just a workaround to fix LPS-17984, now we are upgrading to hibernate 5.X, no longer need the workaround anymore.
- LPS-128873 Migrate StringClobType; keep its logic for backwards compatibility; migrating it to extend MaterializedClobType will cause a lot of problems on upgrading & PostgreSQL, but will revisit in the future to see if we can make it extend TextType instead.
- LPS-128873 Migrate LockModeTranslator: org.hibernate.LockMode#parse(String) -> org.hibernate.LockMode#fromExternalForm(String)
- LPS-128873 Migrate CacheModeTranslator: org.hibernate.CacheMode#parse(String) -> org.hibernate.CacheMode#interpretExternalSetting(String)
- LPS-128873 Migrate IDGenerator: org.hibernate.engine.SessionImplementor -> org.hibernate.engine.spi.SharedSessionContractImplementor
- LPS-128873 Migrate SessionFactoryImpl: org.hibernate.engine.SessionFactoryImplementor -> org.hibernate.engine.spi.SessionFactoryImplementor
- LPS-128873 Migrate event listeners: 1) update packages; 2) avoid using deprecated methods in event listeners
- LPS-128873 Migrate customized property accessors: PropertyAccessor -> PropertyAccessStrategy that works as factory of PropertyAccess
- LPS-128873 Migrate SessionImpl: 1) Session#close() in Hibernate 5 no longer returns Connection, return null here to quick fail; 2) SessionFactoryImplementor#getEntityPersister(String) -> MetamodelImplementor#entityPersister(Class); 3) constructor of EntityKey
- LPS-128873 Migrate: remove FieldInterceptionHelperUtil as the bytecode instrumentation code has been removed from Hibernate and replaced by another infrastructure, see HHH-10280
- LPS-128873 Migrate PortalHibernateConfiguration: move logic to CTModelIntegrator
- LPS-128873 Migrate PortalHibernateConfiguration: move event listeners logic to integrator
- LPS-128873 Migrate PortalHibernateConfiguration: move newConfiguration logic to afterPropertiesSet and buildSessionFactory
- LPS-128873 Migrate PortalHibernateConfiguration: remove the optimization for QueryPlanCache and related property. The related Hibernate issue HHH-4959 has been fixed since 5.2.6, so this particular optimization should not be needed for now.
- LPS-128873 Migrate PortalHibernateConfiguration: move this to buildSessionFactory, as it needs the Configuration (LocalSessionFactoryBuilder)
- LPS-128873 Migrate PortalHibernateConfiguration: Remove deprecated property, use new property
- LPS-128873 Migrate PortalHibernateConfiguration: remove Javassist related code since Hibernate only uses ByteBuddy since 5.6.3
- LPS-128873 Update usage of PortalHibernateConfiguration
- LPS-128873 Migrate: use default DialectResolver as fallback. The proper way to integrate into Hibernate is to customize the DialectFactory service during creating of session factory, but in Liferay there are code depending on the DialectDetector to determine database type outside Hibernate, executed even before initialization of Hibernate. If we go with the Hibernate 5 native way, the execution order during startup needs to be adjusted which would be a big change.
- LPS-128873 Migrate: update packages to org.springframework.orm.hibernate5
- LPS-128873 Migrate: use SessionBuilder from SessionFactory to create session from provided connection
- LPS-128873 Migrate: package name
- LPS-128873 Migrate: portal-spring-extender-impl; the javax.persistence-api is required for compiling as Hibernate 5 SessionFactory extends javax.persistence.EntityManagerFactory
- LPS-128873 Migrate: portal-lock-service; the javax.persistence-api is required for compiling as some Hibernate 5 Exceptions extend javax.persistence.PersistenceException
- LPS-128873 Migrate: StatisticsService
- LPS-128873 Migrate VerifySessionFactoryWrapper: org.hibernate.internal.SessionFactoryImpl#getAllClassMetadata() -> org.hibernate.internal.SessionFactoryImpl#getMetamodel()
- LPS-128873 Fix zero based positional query parameters, see https://hibernate.atlassian.net/browse/HHH-13414
- LPS-128873 Fix no transaction issue
- LPS-128873 Fix compile for test
- LPS-128873 Fix compile for aspectj-hibernate-stale-object-state
- LPS-128873 Fix compile for aspectj-hibernate-unexpected-row-count
- LPS-128873 Fix, auto flush is not working for portlet session as it is considered not in active transaction, add logic to check spring's thread local as what's did in hibernate 3.6
- LPS-128873 Fix exception check in LockLocalServiceTest
- LPS-128873 Fix log assertion by adding expected log on BatchingBatch because SQLExceptions in BatchingBatch are logged twice -- see Log failing SQL when batched execution fails with RTE like StaleStateException hibernate/hibernate-orm#1544
- LPS-128873 Fix exception handling and assertion; when the error "Row was updated or deleted by another transaction" happened, hibernate.core-3.6.10 throw StaleObjectStateException(refer to AbstractEntityPersister.check()). However, hibernate-core-5.5.2 throw StaleStateException(refer to Expectations#BasicExpectation.checkBatched()).
- LPS-128873 Fix LockLocalServiceImpl: Now Hibernate throws a PersistenceException containing a ConstraintViolationException
- LPS-128873 Fix compile for test
- LPS-128873 Fix failure of ViewCountEntryLocalServiceTest caused by double logging (BatchingBatch)
- LPS-128873 [NEED REVISIT] Workaround: solve Hibernate lazy proxy issue "java.lang.NoClassDefFoundError: org/hibernate/proxy/HibernateProxy" during portal startup.
- LPS-128873 Override the method to use LegacyLimitHandler so that it can invoke our SQLServerLimitStringUtil.getLimitString() to generate the sql. Otherwise, it will use SQLServer2005LimitHandler. This will cause JournalFolderServiceImpl.getFoldersAndArticles() generated sql parse failed. But LegacyLimitHandler is deprecated, only LegacyLimitHandler may invoke the getLimitString() method when processing sql.
- LPS-128873 PostgreSQLDialect was deprecated by PostgreSQL82Dialect. In addition, hibernate 5.5.2 provides one class to return different dialects based on different database versions, please see org.hibernate.dialect.Database. In our case, it will return PostgreSQL10Dialect, and PostgreSQL10Dialect extends PostgreSQL82Dialect. So use PostgreSQL10Dialect as the condition.
- LPS-128873 Bypass the strict entity check in Hibernate 5 for Session#contains. In Hibernate 3, if the object's class is not recognized as an entity class (FooImpl in our case), it just returns false; while in Hibernate 5, it throws IllegalArgumentException.
- LPS-128873 Websphere issue. The issue is in the org.hibernate.cfg.AnnotationBinder#bindDefaults(), it will load classes javax.persistence.TableGenerator and javax.persistence.TableGenerators. TableGenerator will be loaded from appserver globalLibDir websphere-9.0.0.0\lib\j2ee.jar, however, TableGenerators doesn't exist in the j2ee.jar. And it existed in portalShieldedContainerLibDir persistence.jar. For the same package, different classes are loaded from different jars which cause the error. For the hibernate 3.6.10, in org.hibernate.cfg.AnnotationBinder#bindDefaults(), it didn't load javax.persistence.TableGenerators, so the issue didn't happen.
…class is deprecated and removed in Hibernate 5, but migrating to the replacement will cause incompatibility with various database software and the databases created by previous Liferay versions.
… Hibernate 5 version of SpringSessionSynchronization
…than CompositeUserType. CompositeUserType is just a workaround to fix LPS-17984, now we are upgrading to hibernate 5.X, no longer need the workaround anymore.
…tibility; migrating it to extend MaterializedClobType will cause a lot of problems on upgrading & PostgreSQL, but will revisit in the future to see if we can make it extend TextType instead.
…tring) -> org.hibernate.LockMode#fromExternalForm(String)
…(String) -> org.hibernate.CacheMode#interpretExternalSetting(String)
…or -> org.hibernate.engine.spi.SharedSessionContractImplementor
…ctoryImplementor -> org.hibernate.engine.spi.SessionFactoryImplementor
…g deprecated methods in event listeners
… PropertyAccessStrategy that works as factory of PropertyAccess
…longer returns Connection, return null here to quick fail; 2) SessionFactoryImplementor#getEntityPersister(String) -> MetamodelImplementor#entityPersister(Class); 3) constructor of EntityKey
…e instrumentation code has been removed from Hibernate and replaced by another infrastructure, see HHH-10280
… logic to integrator
…n logic to afterPropertiesSet and buildSessionFactory
…ion for QueryPlanCache and related property. The related Hibernate issue HHH-4959 has been fixed since 5.2.6, so this particular optimization should not be needed for now.
…ssionFactory, as it needs the Configuration (LocalSessionFactoryBuilder)
…operty, use new property
…ated code since Hibernate only uses ByteBuddy since 5.6.3
…er way to integrate into Hibernate is to customize the DialectFactory service during creating of session factory, but in Liferay there are code depending on the DialectDetector to determine database type outside Hibernate, executed even before initialization of Hibernate. If we go with the Hibernate 5 native way, the execution order during startup needs to be adjusted which would be a big change.
…session from provided connection
…n addition, hibernate 5.5.2 provides one class to return different dialects based on different database versions, please see org.hibernate.dialect.Database. In our case, it will return PostgreSQL10Dialect, and PostgreSQL10Dialect extends PostgreSQL82Dialect. So use PostgreSQL10Dialect as the condition.
…contains. In Hibernate 3, if the object's class is not recognized as an entity class (FooImpl in our case), it just returns false; while in Hibernate 5, it throws IllegalArgumentException.
…otationBinder#bindDefaults(), it will load classes javax.persistence.TableGenerator and javax.persistence.TableGenerators. TableGenerator will be loaded from appserver globalLibDir websphere-9.0.0.0\lib\j2ee.jar, however, TableGenerators doesn't exist in the j2ee.jar. And it existed in portalShieldedContainerLibDir persistence.jar. For the same package, different classes are loaded from different jars which cause the error. For the hibernate 3.6.10, in org.hibernate.cfg.AnnotationBinder#bindDefaults(), it didn't load javax.persistence.TableGenerators, so the issue didn't happen.
To conserve resources, the PR Tester does not automatically run for every pull. If your code changes were already tested in another pull, reference that pull in this pull so the test results can be analyzed. If your pull was never tested, comment "ci:test" to run the PR Tester for this pull. |
ci:test:sf |
ci:test:relevant |
ci:test |
ci:test:upgrade |
❌ ci:test:sf - 0 out of 1 jobs passed in 17 minutesClick here for more details.Base Branch:Branch Name: master Sender Branch:Branch Name: LPS-128873-Hibernate-2022-3-17 1 Failed Jobs:For more details click here.
|
Jenkins Build:test-portal-source-format#612 Jenkins Report:jenkins-report.html Jenkins Suite:sf Pull Request:dantewang#2191 Testray Routine:EE Pull Request Testray Importer:publish-testray-report#2508 |
❌ ci:test:relevant - 0 out of 1 jobs passed in 4 minutesClick here for more details.Base Branch:Branch Name: master Upstream Comparison:Branch GIT ID: be4e29241f15319c98af8d2ac975e28ce3b54b25 ci:test:relevant - 0 out of 1 jobs PASSED1 Failed Jobs:For more details click here.Failures unique to this pull:
For upstream results, click here. |
Jenkins Build:test-portal-acceptance-pullrequest(master)#992 Jenkins Report:jenkins-report.html Jenkins Suite:relevant Pull Request:dantewang#2191 Testray Routine:EE Pull Request Testray Importer:publish-testray-report#2510 |
❌ ci:test:upgrade - 5 out of 18 jobs passed in 3 hours 4 minutesClick here for more details.Base Branch:Branch Name: master Upstream Comparison:Branch GIT ID: 523fbcc89f5e13432496630f9e2af72f5ee40b05 ci:test:upgrade - 5 out of 18 jobs PASSED13 Failed Jobs:
5 Successful Jobs:
For more details click here.Failures unique to this pull:
|
Jenkins Build:test-portal-acceptance-pullrequest(master)#2579 Jenkins Report:jenkins-report.html Jenkins Suite:upgrade Pull Request:dantewang#2191 Testray Routine:EE Pull Request Testray Importer:publish-testray-report#7614 |
❌ ci:test:default - 77 out of 121 jobs passed in 3 hours 43 minutesClick here for more details.Base Branch:Branch Name: master Upstream Comparison:Branch GIT ID: 523fbcc89f5e13432496630f9e2af72f5ee40b05 ci:test:default - 77 out of 121 jobs PASSED44 Failed Jobs:
77 Successful Jobs:
For more details click here.Failures unique to this pull:
|
Jenkins Build:test-portal-acceptance-pullrequest(master)#2578 Jenkins Report:jenkins-report.html Jenkins Suite:default Pull Request:dantewang#2191 Testray Routine:EE Pull Request Testray Importer:publish-testray-report#7616 |