java - HibernateTemplate has incompatible types error after upgrading from Spring 3 to Spring 4 -


I'm trying to upgrade an application to use the latest version of Spring. It currently uses 3.5.6 in Spring 3.0.7 and Hibernate. I am able to successfully upgraded in the spring 3.2.8, but if I did it spring have been upgraded to 4, if I get errors in compiling the following:

  [error] / user / mraible / dev /foo-upgrades/foo-core/src/main/java/com/company/foo/dao/companydb/impl/hibernate/InFaxDAOImpl.java:[71,82] incompatible type [ERROR] necessary : Java.util.List & lt; Com.company.foo.common.domain.FaxPage & gt; [Error] found: java.util.List & lt; Capture # 49? & Gt;   

The method call looks like the following:

  list & lt; Fax page & gt; Fax Page = getHibernateTemplate (). FindByNamedQueryAndNamedParam (query name, hklperm, value);   

I can fix the compilation error by casting list type, but it does not look correct

  list. & Lt; FaxPage & gt; faxPages = (List of & lt; FaxPage & gt;) getHibernateTemplate () findByNamedQueryAndNamedParam (queryName, hqlParams, value).   

Is it about spring 4 that breaks HibernateDaoSupport so it's not backwards compatible?

This is because the Spring Framework has announced a rough list was used for the back and raw list The announcement basically allows you to make the desired announcement of any kind. If you do this, the compiler is a warning that a @SuppressWarnings ("uncontrolled") declaration.

There will continue to be "masked" with the can has been provided for backward compatibility This will suggest many "never use raw lists the new code".

of

The use of raw type is only allowed as a concession for the legacy compatibility quotation code. The use of raw type in the code written after the introduction of commonality in the Java programming language has been strongly disappointed. It is possible that future versions of the Java programming language will reject the use of raw types.

There is a good summary of that matter.

As long as I can certainly understand the benefit of the work you used to do, I advise you to update your code as you did, yes: you already Vested were doing the artist

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -