The hibernate criteria query I'm trying to change looks like this
Criteria crit =
session.createCriteria(device.class)
.createCriteria("deviceConfigurationTemplate")
.createCriteria("deviceModel");
I want to simply change this to use JPA CriteriaQueries instead. The issue I'm having is how javax.persistence to create a query with multiple assoicated entities passed in as strings. I wanted to use JPA root criteria and multiselect them using the criteriaQuery like this
CriteriaBuilder cb = entityManager.getCriteriaBuilder();
CriteriaQuery<Device> cq = cb.createQuery(Device.class);
Root<DeviceModel> model = cq.from(DeviceModel.class);
Root<"deviceConfigurationTemplate"> model2 =
cq.from("deviceConfigurationTemplate");
cq.multiselect(model);
The issue here is you can't pass in a string as a parameter to the root object. I'm not sure how else to go about creating a query like this.