Loading entities without specifying jar in the persistence.xml

Hi, I want to know if there is a way that I can ask hibernate to automatically scan the jar file mentioned in the classpath without specifying it in the persistence.xml, i am using hibernate 6.6.3.Final, i have tried all ways on internet but could not resolve the issue, any help would be appreciated.

whenever i try to persist any entity, i got this error, unable to locate the persister: package name

If you’re using Hibernate in a container like WildFly or Quarkus, this happens automatically.

If you’re using Hibernate in standalone mode, it doesn’t (as per JPA spec). Some time ago I proposed this change which would allow you to specify a URL to be scanned via Configuration, but there was a general lack of enthusiasm for it and so I have never merged it.

ok so can we externalize persistence.xml like not in project’s resources folder maybe somewhere else on my laptop??