public class DataSourceTools
DataSourceTools
provides a number of static utility methods for generating DataSource information from other metadata (database tables, Hibernate mappings and Reflection on existing Java classes)Modifier and Type | Method and Description |
---|---|
static java.util.Map | getDataSourceConfigFromHibernateMapping(java.lang.String entityName) Returns the DataSource configuration map derived from the given Hibernate mapping |
static java.lang.Object | getDataSourceConfigFromJavaClass(java.lang.String className) Returns the DataSource configuration map derived by applying Reflection to the given Java class |
static java.util.Map | getDataSourceConfigFromJPAClass(java.lang.String className) Returns the DataSource configuration map derived from the given JPA-mapped class |
static java.util.Map | getDataSourceConfigFromTable(java.lang.String tableName, java.lang.String schema, java.lang.String serverType, java.lang.String dbName, java.lang.String timestampType, boolean returnSQLTypes) Returns the DataSource configuration map derived from the given database table |
public static java.util.Map getDataSourceConfigFromTable(java.lang.String tableName, java.lang.String schema, java.lang.String serverType, java.lang.String dbName, java.lang.String timestampType, boolean returnSQLTypes) throws java.lang.Exception
tableName
- the name of the tableschema
- the name of the database schema. Some databases require this, others do not; indeed, some do not recognize the conceptserverType
- "sql" or "hibernate", how to obtain a database connectiondbName
- For "sql" types only, the database to connect totimestampType
- The SmartClient field type to use when mapping SQL columns of type TIMESTAMP. Must be "date", "datetime" or "time"; defaults to "datetime".java.lang.Exception
public static java.util.Map getDataSourceConfigFromHibernateMapping(java.lang.String entityName) throws java.lang.Exception
entityName
- the "entity-name" of the Hibernate mappingjava.lang.Exception
public static java.util.Map getDataSourceConfigFromJPAClass(java.lang.String className) throws java.lang.Exception
className
- the name of JPA-mapped classjava.lang.Exception
public static java.lang.Object getDataSourceConfigFromJavaClass(java.lang.String className) throws java.lang.Exception
className
- the fully-qualified class name (eg, com.somecompany.SomeClass)java.lang.Exception