I am trying to find a way to use Guice 4.1 and Hibernate 5.2
I checked the documentation and seems like we need to use a persistence.xml file. I am wondering if we can use Guice and Hibernate without this persistence.xml? is there a way to do what persistence.xml do but programmatically?
Thanks.
Theoretically you could implement your own
javax.persistence.spi.PersistenceUnitInfo
into aMyPunit
and do something likeHowever there should be no need for this. You're supposed to create your own persistence.xml for the application. Why would you want to avoid it?
Here is the minimal persistence.xml you need without listing all the classes (with example dialect):