[jboss-jira] [JBoss JIRA] (WFLY-11991) Add Hibernate ORM transformer option to transform any method parameter of type org.hibernate.engine.spi.SessionImplementor

Scott Marlow (Jira) issues at jboss.org
Wed Apr 17 18:39:00 EDT 2019


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

Scott Marlow commented on WFLY-11991:
-------------------------------------

[~jamezp] It is more of a Hibernate51CompatibilityTransformer bug than a feature.  Previously, we didn't cover applications having more than:
{code}
public Object nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner) throws HibernateException, SQLException {
   ...
    }
{code}

So, applications that also have something like the following failed, due to the internalNullSafeGet() not getting transformed to use the ORM 5.3 SharedSessionContractImplementor type:
{code}
public Object nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner) throws HibernateException, SQLException {
   return internalNullSafeGet(rs, names, session, owner);
    }

private Object internalNullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner) throws HibernateException, SQLException {
...
  }
{code}

I consider this additional transformation to be a bit deeper, than what we initially did.  I didn't just enable this additional transformation because that could cause compatibility issues for some applications that were working without this additional transformation.

> Add Hibernate ORM transformer option to transform any method parameter of type org.hibernate.engine.spi.SessionImplementor
> --------------------------------------------------------------------------------------------------------------------------
>
>                 Key: WFLY-11991
>                 URL: https://issues.jboss.org/browse/WFLY-11991
>             Project: WildFly
>          Issue Type: Bug
>          Components: JPA / Hibernate
>            Reporter: Scott Marlow
>            Assignee: Scott Marlow
>            Priority: Major
>             Fix For: 17.0.0.Beta1
>
>         Attachments: afterchange.zip, beforechange.zip
>
>
> The idea is to transform any class method parameter of type org.hibernate.engine.spi.SessionImplementor, in user application, to instead use type org.hibernate.engine.spi.SharedSessionContractImplementor.
> The test case (change) is for this enhancement is [https://github.com/simkam/wildfly/compare/hibernate_transformer].  
> The test case change is adding an internalNullSafeGet method that should also be transformed to use the SharedSessionContractImplementor type but was not, which led to an application failure with code: 
> {code}
>  public Object nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner) throws HibernateException, SQLException {
>         return internalNullSafeGet(rs, names, session, owner);
>     }
>     private Object internalNullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner) throws HibernateException, SQLException {
>         internalSessionImplementorUsingMethod(session);
>         session.isTransactionInProgress();
>         int result = rs.getInt( names[0] );
>         if ( rs.wasNull() ) return null;
>         return State.values()[result];
>     }
> }
> {code}



--
This message was sent by Atlassian Jira
(v7.12.1#712002)


More information about the jboss-jira mailing list