I am opening this issue following Emmanuel's request on
http://forum.hibernate.org/viewtopic.php?p=2332948#2332948
The tescase attached is a junit Test that shows that an empty hibernate.cfg.xml and the call cfg.configure("/mypath/hibernate.cfg.xml") as shown in the reference documentation
http://www.hibernate.org/hib_docs/entitymanager/reference/en/html/configuration.html#setup-configuration-bootstrapping
is needed for EntityManagerFactory programatic construction.
The TestCase shows two scnerios with and without hibernate.cfg.xml. The scenarios are building a EntityManagerFactory and either try to persist or retrive an entity of type org.hibernate.ejb.test.Distributor included in HEM's test suite. The hibernate.cfg.xml file is genrated at Runtime and deleted upon VM exit, the varaiable HIBERNATE_CFG_XML_DIR should point to a folder on the classpath. It is created within the initWithHibernateCfgXML method and it is really a file with the bear minimum of empty tags. There are four tests, two failing and the other two passing, the passing tests create the temp XML config file if not already created, and then make the cfg.configure(resource) call, then simply invoke the corresponding failing test.
I hope the TestCase and the above explanation are describing the issue properly.