本文整理匯總了Java中org.hibernate.cfg.Configuration.getProperty方法的典型用法代碼示例。如果您正苦於以下問題:Java Configuration.getProperty方法的具體用法?Java Configuration.getProperty怎麽用?Java Configuration.getProperty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.hibernate.cfg.Configuration
的用法示例。
在下文中一共展示了Configuration.getProperty方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: fixSchemaInFormulas
import org.hibernate.cfg.Configuration; //導入方法依賴的package包/類
public static void fixSchemaInFormulas(Configuration cfg) {
cfg.buildMappings();
String schema = cfg.getProperty("default_schema");
if (schema!=null) {
for (Iterator i=cfg.getClassMappings();i.hasNext();) {
PersistentClass pc = (PersistentClass)i.next();
for (Iterator j=pc.getPropertyIterator();j.hasNext();) {
Property p = (Property)j.next();
for (Iterator k=p.getColumnIterator();k.hasNext();) {
Selectable c = (Selectable)k.next();
if (c instanceof Formula) {
Formula f = (Formula)c;
if (f.getFormula()!=null && f.getFormula().indexOf("%SCHEMA%")>=0) {
f.setFormula(f.getFormula().replaceAll("%SCHEMA%", schema));
sLog.debug("Schema updated in "+pc.getClassName()+"."+p.getName()+" to "+f.getFormula());
}
}
}
}
}
}
}
示例2: changeDialect
import org.hibernate.cfg.Configuration; //導入方法依賴的package包/類
/**
* Substitute the dialect with an alternative, if possible.
*
* @param cfg
* the configuration
* @param dialect
* the dialect
* @return the dialect
*/
private Dialect changeDialect(Configuration cfg, Dialect dialect)
{
String dialectName = cfg.getProperty(Environment.DIALECT);
if (dialectName == null || dialectName.length() == 0)
{
// Fix the dialect property to match the detected dialect
cfg.setProperty(Environment.DIALECT, dialect.getClass().getName());
}
return dialect;
// TODO: https://issues.alfresco.com/jira/browse/ETHREEOH-679
// else if (dialectName.equals(Oracle9Dialect.class.getName()))
// {
// String subst = AlfrescoOracle9Dialect.class.getName();
// LogUtil.warn(logger, WARN_DIALECT_SUBSTITUTING, dialectName, subst);
// cfg.setProperty(Environment.DIALECT, subst);
// }
// else if (dialectName.equals(MySQLDialect.class.getName()))
// {
// String subst = MySQLInnoDBDialect.class.getName();
// LogUtil.warn(logger, WARN_DIALECT_SUBSTITUTING, dialectName, subst);
// cfg.setProperty(Environment.DIALECT, subst);
// }
// else if (dialectName.equals(MySQL5Dialect.class.getName()))
// {
// String subst = MySQLInnoDBDialect.class.getName();
// LogUtil.warn(logger, WARN_DIALECT_SUBSTITUTING, dialectName, subst);
// cfg.setProperty(Environment.DIALECT, subst);
// }
}
示例3: configure
import org.hibernate.cfg.Configuration; //導入方法依賴的package包/類
public static void configure(Configuration config) {
sGenClass = config.getProperty("tmtbl.uniqueid.generator");
if (sGenClass==null) sGenClass = "org.hibernate.id.SequenceGenerator";
sDefaultSchema = config.getProperty("default_schema");
sNormalizer = config.createMappings().getObjectNameNormalizer();
}