Skip to content

Allow StandardServiceRegistryBuilder.configure() if the hibernate.cfg.xml is not found using the prior ways to set it up #252

Answered by ar
chhil asked this question in Q&A
Discussion options

You must be logged in to vote

jPOS-EE expects the template file hibernate.cfg.xml at the top of the classpath. In order to override the default with a custom hibernate.cfg.xml one needs to call DB db = new DB ("path/to/hibernate.cfg.xml") or configure HIBERNATE_CFG property (that can be done from code using System.setProperty("HIBERNATE_CFG", "path/to/hibernate.cfg.xml") once from your application.

That said, we'll think about an easy way to override it using a convention name (that could be cfg/hibernate.cfg.xml)

I'm thinking along the lines of:

  • If there's a cfg/hibernate.cfg.xml in the filesystem and HIBERNATE_CFG environment variable is not present, we use that file
  • otherwise, we keep the existing behavior

Would …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@chhil
Comment options

Answer selected by chhil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants