com.mycompany.core.util.ProductUtils
to perform various operations that I need. I will be calling these methods in the thymeleaf templates. Now, I would like to get the entity manager instance into this ProductUtils class. How could I get that?
Code: Select all
// import statements omitted
public class ProductUtils
{
@PersistenceContext(unitName="blPU")
EntityManager em;
// ... methods
}
Do I need to do anything else, beside adding this class in the persistence.xml in the blPU section and adding it to the application-entity.xml in the core module.
Thanks in advance. Hope you will reply as soon as possible.