[jboss-jira] [JBoss JIRA] (WFLY-10520) Add Hibernate ORM 5.3 compatibility transformer

Scott Marlow (JIRA) issues at jboss.org
Wed Jun 13 10:14:00 EDT 2018


    [ https://issues.jboss.org/browse/WFLY-10520?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13590980#comment-13590980 ] 

Scott Marlow edited comment on WFLY-10520 at 6/13/18 10:13 AM:
---------------------------------------------------------------

Note from [~gbadner]:
{quote}
I ran a simple test that executed:
s.createQuery( "from A" ).setMaxResults( 0 ).list()
When built with 5.1, it returns all A entities.

When built with 5.3, it returns an empty list.

This is not good.
{quote}
I can think of two options:
# If the WF bytecode transformer doesn't handle Query#getMaxResults, then the application will need to be rewritten to properly use the new Query#getMaxResults as well as Query#setMaxResults() behaviour.
# Other approach might be for the WF bytecode transformer to check for calls to Query#setMaxResults and rewrite the bytecode to work, not that we know yet, what code changes are needed to make the 5.1 app code work with 5.3 yet (Gail?).

A concern about the second approach of the transformer going a bit deeper into application code rewriting, is if the Hibernate team fixes a bug in 5.3.x that impacts the setMaxResults behaviour, the transformer would also need to be fixed as well.



was (Author: smarlow):
Note from [~gbadner]:
{quote}
I ran a simple test that executed:
s.createQuery( "from A" ).setMaxResults( 0 ).list()
When built with 5.1, it returns all A entities.

When built with 5.3, it returns an empty list.

This is not good.
{quote}
I can think of two options:
# If the WF bytecode transformer doesn't handle Query#getMaxResults, then the application will need to be rewritten to properly use the new Query#getMaxResults as well as Query#setMaxResults() behaviour.
# Other approach might be for the WF bytecode transformer to check for calls to Query#setMaxResults and rewrite the bytecode to work.



> Add Hibernate ORM 5.3 compatibility transformer
> -----------------------------------------------
>
>                 Key: WFLY-10520
>                 URL: https://issues.jboss.org/browse/WFLY-10520
>             Project: WildFly
>          Issue Type: Task
>          Components: JPA / Hibernate
>            Reporter: Gail Badner
>            Assignee: Scott Marlow
>             Fix For: 14.0.0.CR1
>
>
> A compatibility transformer needs to be added to address Hibernate ORM 5.3 API methods that are no longer compatible with 5.1.
> From https://docs.google.com/document/d/1cAVBdeQXQfpTwH0f_GKSahh_gRd7bKI6kII-wxoMglU
> # Change call to org.hibernate.BasicQueryContract.getFlushMode() to instead call BasicQueryContract.getHibernateFlushMode().
> # Change call to org.hibernate.Session.getFlushMode, to instead call Session.getHibernateFlushMode()
> # Modify calls to org.hibernate.Query.getFirstResult() to convert returned int, to Integer result.
> # Modify calls to org.hibernate.Query.getMaxResults() to convert returned int, to Integer result, if returned int value is <= 0, null should be used, if Integer.MAX_VALUE is, the transformer should replace with null reference.
> # App References to Enum org.hibernate.FlushMode.NEVER (0) should be transformed to reference FlushMode.MANUAL (0) instead.   



--
This message was sent by Atlassian JIRA
(v7.5.0#75005)


More information about the jboss-jira mailing list