Package com.isomorphic.tools
Class DataSourceTools
java.lang.Object
com.isomorphic.base.Base
com.isomorphic.tools.DataSourceTools
- All Implemented Interfaces:
com.isomorphic.base.IAutoConfigurable
public class DataSourceTools extends com.isomorphic.base.Base
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)-
Method Summary
Modifier and TypeMethodDescriptionstatic Map
getDataSourceConfigFromHibernateMapping
(String entityName) Returns the DataSource configuration map derived from the given Hibernate mappingstatic Object
getDataSourceConfigFromJavaClass
(String className) Returns the DataSource configuration map derived by applying Reflection to the given Java classstatic Map
getDataSourceConfigFromJPAClass
(String className) Returns the DataSource configuration map derived from the given JPA-mapped classstatic Map
getDataSourceConfigFromTable
(String tableName, String schema, String serverType, String dbName, String timestampType, boolean returnSQLTypes) Returns the DataSource configuration map derived from the given database table
-
Method Details
-
getDataSourceConfigFromTable
public static Map getDataSourceConfigFromTable(String tableName, String schema, String serverType, String dbName, String timestampType, boolean returnSQLTypes) throws Exception Returns the DataSource configuration map derived from the given database table- Parameters:
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".- Returns:
- The DataSource configuration map, or null if the configuration could not be derived (for example, because the table did not exist)
- Throws:
Exception
-
getDataSourceConfigFromHibernateMapping
Returns the DataSource configuration map derived from the given Hibernate mapping- Parameters:
entityName
- the "entity-name" of the Hibernate mapping- Returns:
- The DataSource configuration map, or null if the given entity name was not found
- Throws:
Exception
-
getDataSourceConfigFromJPAClass
Returns the DataSource configuration map derived from the given JPA-mapped class- Parameters:
className
- the name of JPA-mapped class- Returns:
- The DataSource configuration map, or null if the given class name was not found
- Throws:
Exception
-
getDataSourceConfigFromJavaClass
Returns the DataSource configuration map derived by applying Reflection to the given Java class- Parameters:
className
- the fully-qualified class name (eg, com.somecompany.SomeClass)- Returns:
- The DataSource configuration map, or null if the given class was not found
- Throws:
Exception
-