/** * Creates a new instance of a DbConnectionFactory. The factory loads the persistence.xml file * which must be found at '/META-INF/persistence.xml'. * @return DbConnectionFactory instance */ public static DbConnectionFactory createInstance() { return DbConnectionFactoryLoader.createInstance("/META-INF/persistence.xml"); }
/** * Creates a new instance of a DbConnectionFactory using the specified resource.xml file * @param persistenceXmlPath Path to resource.xml file, e.g. /META-INF/persistence.xml * @return DbConnectionFactory intance */ public static DbConnectionFactory createInstance(String persistenceXmlPath) { try { return new DbConnectionFactoryLoader().loadFromXml(persistenceXmlPath); } catch (Exception ex) { throw new JuRuntimeException("Couldn't create DbConnectionFactory instance", ex); } }
/** * Gets an instance of DbConnectionFactory that connects to a Derby Test DB. * <p> * The factory contains one connection named 'Derby InMemory-DB' * @return DbConnectionFactory instance */ public static DbConnectionFactory getDerbyTestDbConnectionFactory() { return DbConnectionFactoryLoader.createInstance("/META-INF/ju-testing_persistence.xml"); }