Guiced Persistence allows you to configure your configurations in any way, programmatically deciding what to use based on any means you deem necessary
The following services providers are available
IPropertiesConnectionInfoReader - A functional interface to populate a connection base info based on properties received IPropertiesEntityManagerReader - Manages properties passed into the entity manager factory ITransactionHandler - A service for managing Entity Manager Transactions automagic like
These allow to manipulate the
ConnectionBaseInfo
specified by each DatabaseModule
accordingly.
The following services are provided by default and each provide properties that you can manipulate (or use persistence.xml file properties)
ITransactionHandler - BTMAutomatedTransactionHandler, JPAAutomatedTransactionHandler IPropertiesEntityManagerReader - SystemEnvironmentVariablesPropertiesReader, HibernateEntityManagerProperties, BTMConnectionProperties IPropertiesConnectionInfoReader - JPADefaultConnectionBaseBuilder, HibernateDefaultConnectionBaseBuilder
Each of the handlers perform a specific function in order to correctly load a persistence unit
BTMAutomatedTransactionHandler - Handles transaction start and stops for JTA (EntityAssist) JPAAutomatedTransactionHandler - Manages transactions start and stops for JTA (EntityAssist) BTMConnectionProperties - Applies the default persistence.xml properties to connect to BTM for transaction management HibernateEntityManagerProperties - Assigns programmatic changes to persistence.xml for hibernate specific properties SystemEnvironmentVariablesPropertiesReader - Allows setting persistence.xml properties based on system environment variables ${os.name} JPADefaultConnectionBaseBuilder - Reads persistence.xml persistence properties and sets the ConnectionBaseInfo accordingly HibernateDefaultConnectionBaseBuilder - Reads persistence.xml hibernate properties and sets the ConnectionBaseInfo accordinglyEvery aspect of the connection (should) be modifyable allowing straight forward access to testing your entities and classes
Additional examples modules are available to see how to map from other sources,
- Wildfly Connection Properties - Reads standalone files for connection information
- C3P0 Properties - Dynamically set C3P0 pool properties within your code
- Use
WildflyConnectionInfoBuilder.setStandaloneFileName("standalone-full-ha.xml");
to set which file to read from
- Set the
${jboss.server.config.dir}
accordingly
- You can create services for
IWildflyDriverRegistration
to register any custom drivers whose properties are unable to read
- By default SQL Server and DB2 drivers are made available and provide good examples of registering your own