public final class HibernateSetup extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
DB_TABLE_NAME_PARAM |
static String |
HIBERNATE_CONNECTION_DRIVER_CLASS_PARAM |
static String |
HIBERNATE_CONNECTION_PASSWORD_PARAM |
static String |
HIBERNATE_CONNECTION_URL_PARAM |
static String |
HIBERNATE_CONNECTION_USERNAME_PARAM |
static String |
HIBERNATE_DIALECT_PARAM |
| Modifier and Type | Method and Description |
|---|---|
static void |
close(org.hibernate.SessionFactory sf,
org.hibernate.Session s)
Closing the Hibernate resources -
SessionFactory
and the Session. |
static boolean |
createTable(org.hibernate.boot.Metadata metadata)
Based on the provided Hibernate
Metadata it runs schema export
to generate database schema aka. |
static Properties |
getConfigurationProperties()
Loading hibernate setup data only from environmental and system properties.
|
static Properties |
getConfigurationProperties(ParsedArguments args)
Boot-up the app by gathering properties needed for Hibernate start-up.
Method searches for values and then create the hibernate setup based on it. |
static org.hibernate.boot.Metadata |
getHibernateStartupMetadata(Properties setupProperties,
org.hibernate.service.ServiceRegistry standardRegistry)
Setting up the Hibernate as standalone app.
|
static org.hibernate.boot.registry.StandardServiceRegistry |
getStandardRegistry(Properties setupProperties)
Generate hibernate registry while filling it with properties.
|
static String |
getTableName(Properties setupProperties)
Returning current table name being used in the app for saving the recovery markers.
|
public static final String DB_TABLE_NAME_PARAM
public static final String HIBERNATE_DIALECT_PARAM
public static final String HIBERNATE_CONNECTION_DRIVER_CLASS_PARAM
public static final String HIBERNATE_CONNECTION_URL_PARAM
public static final String HIBERNATE_CONNECTION_USERNAME_PARAM
public static final String HIBERNATE_CONNECTION_PASSWORD_PARAM
public static Properties getConfigurationProperties(ParsedArguments args)
Boot-up the app by gathering properties needed for Hibernate start-up.
Method searches for values and then create the hibernate setup based on it.
It uses ParsedArguments to get values for the properties
and it uses system properties and env properties as another source
to setup values.
args - values to be used as the most important for the setuppublic static Properties getConfigurationProperties()
public static org.hibernate.boot.registry.StandardServiceRegistry getStandardRegistry(Properties setupProperties)
setupProperties - properties for connectionpublic static org.hibernate.boot.Metadata getHibernateStartupMetadata(Properties setupProperties, org.hibernate.service.ServiceRegistry standardRegistry)
Metadata filled from provided properties.setupProperties - properties, probably taken from getConfigurationProperties()standardRegistry - hibernate registry to be used for being able to link table naming strategySession creationpublic static String getTableName(Properties setupProperties)
setupProperties - properties to search for the db table namepublic static boolean createTable(org.hibernate.boot.Metadata metadata)
Metadata it runs schema export
to generate database schema aka. tables.metadata - hibernate metadata as base for db schema generationpublic static void close(org.hibernate.SessionFactory sf,
org.hibernate.Session s)
SessionFactory
and the Session.sf - session factory to be closeds - session to be closedCopyright © 2018. All rights reserved.