Open sebastian-j-ibanez opened 1 month ago
Additional instructions from @yingbull:
"hibernate; unless one of the update is advised to skip entirely, I would just walk it up patch versions (5.x.##) and minor versions (5.##.xx) till you get to the latest 5.6.x, one at a time, branch and pull request at a time. We are at least now getting close to "common era" so you should be able to find some discussions and migration guides, @garciaerin, @sebastian-j-ibanez.
Just a tip: don't worry about something getting deprecated in the version you are trying to upgrade to: deprecated means it works but they want you to stop. We like works :slightly_smiling_face: given we have a number of upgrades to do, focus on just remediating breaking changes. Fixing deprecated stuff to recommended, unless a security risk, is a luxury for when you are at a supported, up to date version of your framework."
Adding this information here so we have everything in one place.
org/oscarehr/common
.DaoImpl
files from O-W.This issue has been implemented in PR #200.
We need to upgrade hibernate to the latest version of 5.6.X.
After upgraded to version 5.6.15.Final, we're encountering error: "java.lang.IllegalArgumentException: org.hibernate.QueryException: Legacy-style query parameters (?) are no longer supported; use JPA-style ordinal parameters (e.g., ?1) instead"
Since hibernate 5.6.15 doesn't support "?" as the query parameter, we have to insert number (use JPA-style ordinal parameters) after the "?". The best practice is to insert 1 after the "?" since it is the standards of JPA API, but we need to first refactor all the queries using Hibernate API to JPA API. Below is the example we have now:
import java.util.List;
import javax.persistence.TypedQuery;
import org.apache.commons.lang.time.DateUtils; import org.apache.logging.log4j.Logger; import org.oscarehr.PMmodule.model.AccessType; import org.oscarehr.PMmodule.model.ProgramAccess; import org.oscarehr.util.MiscUtils; import org.oscarehr.util.QueueCache; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import org.springframework.stereotype.Repository;
@Repository public class ProgramAccessDAOImpl implements ProgramAccessDAO {
The most ideal solution is to extend the AbstractDaoImpl class, so we won't need to implemented the jpa imports and annotation in the single class. We are going to keep working on this when we move to Hibernate 6, right now we will keep most of the Hibernate queries having "?0" to ensure the application runs properly.
Updates: