Skip to main content
Skip table of contents

Updating Plugins for Changes in XNAT Dependencies

With the release of XNAT 1.9, several upgrades and new features have been introduced. However, these changes may impact the functionality of existing plugins. To ensure a smooth transition, we recommend testing the plugins in a separate environment before upgrading. If any issues arise, it is necessary to update the plugins to support the new version.

Here are the key changes in XNAT 1.9 that may affect plugin compatibility:

  1. Hibernate Upgrade:

    • Hibernate has been upgraded from version 4.3.11 to 5.6.15.Final. Please review your code for any potential compatibility issues.

  2. Annotations Update:

    • The package org.jetbrains.annotations has been removed in XNAT 1.9. Annotations such as @NotNull and @Nullable are now part of the javax.annotation package. Update your code accordingly:

      DIFF
      - import org.jetbrains.annotations.NotNull;
      + import javax.validation.constraints.NotNull;
      
      - import org.jetbrains.annotations.Nullable;
      + import javax.annotation.Nullable;
      
  3. JCache Implementation:

    • XNAT 1.9 now uses JCache as the new caching mechanism, replacing the old cache implementation. Make sure to update any relevant annotations:

      DIFF
      - @Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "nrg")
      + @Cacheable
      public class DqrProjectSettings
      
  4. Hibernate Criteria Query Deprecation:

    • The Hibernate Criteria query is deprecated in XNAT 1.9. It is recommended to use JPA Criteria query for accessing data from the database. Additionally, a new QueryBuilder class has been added to the BaseHibernateService:

      CODE
      /**
        * Returns a new {@link QueryBuilder query builder} for the entity type.
        *
        * @return A new {@link QueryBuilder query builder} instance.
        */
      @SuppressWarnings("unused")
      QueryBuilder<E> newQueryBuilder();
      

      AbstractHibernateDAO.java

      CODE
          public List<E> findAllByExample(final E example, final String[] excludeProperties) {
              QueryBuilder<E> queryBuilder = newQueryBuilder();
              final Predicate predicate    = queryBuilder.example(example, Arrays.asList(excludeProperties));
              queryBuilder.where(predicate);
              return queryBuilder.getResults();
          }
      
  5. Additional References:

    • For further guidance on JPA Criteria query and JCache usage, refer to the following classes:

      • SimpleEntity.java

      • SimpleEntityDAO.java

      • SimpleEntityService.java

      • HibernateSimpleEntityService.java

      • SimpleEntityServiceTest.java

      • SimpleEntityServiceTestConfiguration.java

For more information on updating plugins, please visit the following links:

https://bitbucket.org/xnatdev/dicom-query-retrieve/pull-requests/73/overview
https://bitbucket.org/xnatdev/container-service/pull-requests/120

If you encounter any issues during the upgrade process, please provide feedback in the discussion, and we will assist you accordingly.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.