I’ve just updated my Quarkus project from version 2 to version 3, one big change that they made is the fact that they now use jakarta domain instead of javax.
Obviously i used their CLI to update the project, as suggested in this guide: https://github.com/quarkusio/quarkus/wiki/Migration-Guide-3.0~
However i’m now getting this error with BlazeBit persistence:
“The method create(EntityManager, Class) from the type CriteriaBuilderFactory refers to the missing type EntityManager”
package it.scdn.sale.repository;
import com.blazebit.persistence.CriteriaBuilder;
import com.blazebit.persistence.CriteriaBuilderFactory;
import com.blazebit.persistence.view.EntityViewManager;
import jakarta.inject.Inject;
import jakarta.persistence.EntityManager;
import jakarta.persistence.PersistenceContext;
public abstract class CriteriaRepository {
@PersistenceContext
protected EntityManager em;
@Inject
protected CriteriaBuilderFactory cbf;
@Inject
protected EntityViewManager evm;
/**
* Get the entity manager.
*
* @return entity manager object
*/
public EntityManager getEm() {
return em;
}
/**
* Set entity manager.
*
* @param em entity manager object
*/
public void setEm(final EntityManager em) {
this.em = em;
}
/**
* Get criteria builder factory object.
*
* @return cbf
*/
public CriteriaBuilderFactory getCbf() {
return cbf;
}
/**
* Set criteria builder factory object.
*
* @param cbf cbf object
*/
public void setCbf(final CriteriaBuilderFactory cbf) {
this.cbf = cbf;
}
/**
* Get entity view manager.
*
* @return evm object
*/
public EntityViewManager getEvm() {
return evm;
}
/**
* Set entity view manager.
*
* @param evm evm object
*/
public void setEvm(final EntityViewManager evm) {
this.evm = evm;
}
/**
* Factory for criteria API.
*
* @param tClass tClass param
* @param <T> class type
* @return custom criteria from the TClass
*/
protected <T> CriteriaBuilder<T> initCriteria(final Class<T> tClass) {
return cbf.create(em, tClass);
}
}
While looking at the source code i noticed that the create method requires a javax entityManager, could this the reason why its not finding it? Is there a workaround or am i missing something?
/**
* Like {@link CriteriaBuilderFactory#create(javax.persistence.EntityManager, java.lang.Class, java.lang.String)} but with the alias
* equivalent to the camel cased result of what {@link Class#getSimpleName()} of the result class returns.
*
* @param entityManager The entity manager to use for the criteria builder
* @param resultClass The result class of the query
* @param <T> The type of the result class
* @return A new criteria builder
*/
public <T> CriteriaBuilder<T> create(EntityManager entityManager, Class<T> resultClass);
This is the dependecy i have in my pom:
<dependency>
<groupId>io.quarkus.platform</groupId>
<artifactId>quarkus-blaze-persistence-bom</artifactId>
<version>3.14.2</version>
<type>pom</type>
<scope>import</scope>
</dependency>
2