本文整理了Java中org.hibernate.cfg.Configuration.setNamingStrategy()
方法的一些代码示例,展示了Configuration.setNamingStrategy()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.setNamingStrategy()
方法的具体详情如下:
包路径:org.hibernate.cfg.Configuration
类名称:Configuration
方法名:setNamingStrategy
[英]Set a custom naming strategy
[中]设置自定义命名策略
代码示例来源:origin: org.hibernate/hibernate-annotations
@Override
public AnnotationConfiguration setNamingStrategy(NamingStrategy namingStrategy) {
super.setNamingStrategy( namingStrategy );
return this;
}
代码示例来源:origin: babyfish-ct/babyfish
@Override
public Configuration setNamingStrategy(NamingStrategy namingStrategy) {
super.setNamingStrategy(namingStrategy);
return this;
}
代码示例来源:origin: org.hibernate/com.springsource.org.hibernate
@Override
public AnnotationConfiguration setNamingStrategy(NamingStrategy namingStrategy) {
super.setNamingStrategy( namingStrategy );
return this;
}
代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core
@Override
public AnnotationConfiguration setNamingStrategy(NamingStrategy namingStrategy) {
super.setNamingStrategy( namingStrategy );
return this;
}
代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.ejb
public Ejb3Configuration setNamingStrategy(NamingStrategy namingStrategy) {
cfg.setNamingStrategy( namingStrategy );
return this;
}
代码示例来源:origin: org.codehaus.griffon.plugins/griffon-hibernate4-core
private void applyNamingStrategy(Configuration config) {
Object namingStrategy = getConfigValue(sessionConfig, NAMING_STRATEGY, null);
if (namingStrategy instanceof Class) {
config.setNamingStrategy((NamingStrategy) newInstanceOf((Class) namingStrategy));
} else if (namingStrategy instanceof String) {
config.setNamingStrategy((NamingStrategy) newInstanceOf((String) namingStrategy));
}
}
代码示例来源:origin: io.robe/robe-hibernate
private void determineNamingStrategy(Configuration configuration) {
String prefix = configuration.getProperty("hibernate.prefix");
if (prefix != null) {
configuration.setNamingStrategy(new RobeHibernateNamingStrategy(prefix));
LOGGER.info("Table Prefix: ", prefix);
}
String namingStrategy = configuration.getProperty("hibernate.namingStrategy");
if (namingStrategy != null) {
LOGGER.warn("Hibernate.prefix property will be ignored, cause: another type of naming strategy selected");
try {
configuration.setNamingStrategy((NamingStrategy) Class.forName(namingStrategy).newInstance());
} catch (Exception e) {
LOGGER.error("Can't set Hibernate Naming Strategy", e);
}
}
}
代码示例来源:origin: hibernate/hibernate
private Configuration getConfiguration() throws Exception {
Configuration cfg = new Configuration();
if (namingStrategy!=null) cfg.setNamingStrategy(
(NamingStrategy) ReflectHelper.classForName(namingStrategy).newInstance()
);
if (configurationFile != null) cfg.configure( new File(configurationFile) );
String[] files = getFiles();
for (int i = 0; i < files.length; i++) {
String filename = files[i];
if ( filename.endsWith(".jar") ) {
cfg.addJar( new File(filename) );
}
else {
cfg.addFile(filename);
}
}
return cfg;
}
代码示例来源:origin: jboss.jboss-embeddable-ejb3/hibernate-all
cfg.setNamingStrategy(
( NamingStrategy ) ReflectHelper.classForName( args[i].substring( 9 ) ).newInstance()
);
代码示例来源:origin: hibernate/hibernate
private Configuration getConfiguration() throws Exception {
Configuration cfg = new Configuration();
if (namingStrategy!=null) cfg.setNamingStrategy(
(NamingStrategy) ReflectHelper.classForName(namingStrategy).newInstance()
);
if (configurationFile!=null) cfg.configure( new File(configurationFile) );
String[] files = getFiles();
for (int i = 0; i < files.length; i++) {
String filename = files[i];
if ( filename.endsWith(".jar") ) {
cfg.addJar( new File(filename) );
}
else {
cfg.addFile(filename);
}
}
return cfg;
}
代码示例来源:origin: org.beangle.commons/beangle-commons-orm
public void gen(String dialect, String fileName) throws HibernateException, IOException {
Configuration configuration = new OverrideConfiguration();
PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(
DdlGenerator.class.getClassLoader());
configuration.getProperties().put(Environment.DIALECT, dialect);
// config naming strategy
DefaultTableNamingStrategy tableNamingStrategy = new DefaultTableNamingStrategy();
for (Resource resource : resolver.getResources("classpath*:META-INF/beangle/table.properties"))
tableNamingStrategy.addConfig(resource.getURL());
RailsNamingStrategy namingStrategy = new RailsNamingStrategy();
namingStrategy.setTableNamingStrategy(tableNamingStrategy);
configuration.setNamingStrategy(namingStrategy);
for (Resource resource : resolver.getResources("classpath*:META-INF/hibernate.cfg.xml"))
configuration.configure(resource.getURL());
SchemaExport export = new SchemaExport(configuration);
export.setOutputFile(fileName);
export.execute(false, false, false, true);
}
}
代码示例来源:origin: org.hibernate/com.springsource.org.hibernate
private Configuration getConfiguration() throws Exception {
Configuration cfg = new Configuration();
if (namingStrategy!=null) {
cfg.setNamingStrategy(
(NamingStrategy) ReflectHelper.classForName(namingStrategy).newInstance()
);
}
if (configurationFile != null) {
cfg.configure( configurationFile );
}
String[] files = getFiles();
for (int i = 0; i < files.length; i++) {
String filename = files[i];
if ( filename.endsWith(".jar") ) {
cfg.addJar( new File(filename) );
}
else {
cfg.addFile(filename);
}
}
return cfg;
}
代码示例来源:origin: jboss.jboss-embeddable-ejb3/hibernate-all
private Configuration getConfiguration() throws Exception {
Configuration cfg = new Configuration();
if (namingStrategy!=null) {
cfg.setNamingStrategy(
(NamingStrategy) ReflectHelper.classForName(namingStrategy).newInstance()
);
}
if (configurationFile!=null) {
cfg.configure( configurationFile );
}
String[] files = getFiles();
for (int i = 0; i < files.length; i++) {
String filename = files[i];
if ( filename.endsWith(".jar") ) {
cfg.addJar( new File(filename) );
}
else {
cfg.addFile(filename);
}
}
return cfg;
}
代码示例来源:origin: jboss.jboss-embeddable-ejb3/hibernate-all
private Configuration getConfiguration() throws Exception {
Configuration cfg = new Configuration();
if (namingStrategy!=null) {
cfg.setNamingStrategy(
(NamingStrategy) ReflectHelper.classForName(namingStrategy).newInstance()
);
}
if (configurationFile != null) {
cfg.configure( configurationFile );
}
String[] files = getFiles();
for (int i = 0; i < files.length; i++) {
String filename = files[i];
if ( filename.endsWith(".jar") ) {
cfg.addJar( new File(filename) );
}
else {
cfg.addFile(filename);
}
}
return cfg;
}
代码示例来源:origin: org.hibernate/com.springsource.org.hibernate
private Configuration getConfiguration() throws Exception {
Configuration cfg = new Configuration();
if (namingStrategy!=null) {
cfg.setNamingStrategy(
(NamingStrategy) ReflectHelper.classForName(namingStrategy).newInstance()
);
}
if (configurationFile!=null) {
cfg.configure( configurationFile );
}
String[] files = getFiles();
for (int i = 0; i < files.length; i++) {
String filename = files[i];
if ( filename.endsWith(".jar") ) {
cfg.addJar( new File(filename) );
}
else {
cfg.addFile(filename);
}
}
return cfg;
}
代码示例来源:origin: org.hibernate/com.springsource.org.hibernate
private Configuration getConfiguration() throws Exception {
Configuration cfg = new Configuration();
if (namingStrategy!=null) {
cfg.setNamingStrategy(
(NamingStrategy) ReflectHelper.classForName( namingStrategy ).newInstance()
);
}
if (configurationFile!=null) {
cfg.configure( configurationFile );
}
String[] files = getFiles();
for (int i = 0; i < files.length; i++) {
String filename = files[i];
if ( filename.endsWith(".jar") ) {
cfg.addJar( new File(filename) );
}
else {
cfg.addFile(filename);
}
}
return cfg;
}
代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core
private Configuration getConfiguration() throws Exception {
Configuration cfg = new Configuration();
if (namingStrategy!=null) {
cfg.setNamingStrategy(
(NamingStrategy) ReflectHelper.classForName(namingStrategy).newInstance()
);
}
if (configurationFile!=null) {
cfg.configure( configurationFile );
}
String[] files = getFiles();
for (int i = 0; i < files.length; i++) {
String filename = files[i];
if ( filename.endsWith(".jar") ) {
cfg.addJar( new File(filename) );
}
else {
cfg.addFile(filename);
}
}
return cfg;
}
代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core
private Configuration getConfiguration() throws Exception {
Configuration cfg = new Configuration();
if (namingStrategy!=null) {
cfg.setNamingStrategy(
(NamingStrategy) ReflectHelper.classForName( namingStrategy ).newInstance()
);
}
if (configurationFile!=null) {
cfg.configure( configurationFile );
}
String[] files = getFiles();
for (int i = 0; i < files.length; i++) {
String filename = files[i];
if ( filename.endsWith(".jar") ) {
cfg.addJar( new File(filename) );
}
else {
cfg.addFile(filename);
}
}
return cfg;
}
代码示例来源:origin: jboss.jboss-embeddable-ejb3/hibernate-all
private Configuration getConfiguration() throws Exception {
Configuration cfg = new Configuration();
if (namingStrategy!=null) {
cfg.setNamingStrategy(
(NamingStrategy) ReflectHelper.classForName(namingStrategy).newInstance()
);
}
if (configurationFile!=null) {
cfg.configure( configurationFile );
}
String[] files = getFiles();
for (int i = 0; i < files.length; i++) {
String filename = files[i];
if ( filename.endsWith(".jar") ) {
cfg.addJar( new File(filename) );
}
else {
cfg.addFile(filename);
}
}
return cfg;
}
代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core
private Configuration getConfiguration() throws Exception {
Configuration cfg = new Configuration();
if (namingStrategy!=null) {
cfg.setNamingStrategy(
(NamingStrategy) ReflectHelper.classForName(namingStrategy).newInstance()
);
}
if (configurationFile != null) {
cfg.configure( configurationFile );
}
String[] files = getFiles();
for (int i = 0; i < files.length; i++) {
String filename = files[i];
if ( filename.endsWith(".jar") ) {
cfg.addJar( new File(filename) );
}
else {
cfg.addFile(filename);
}
}
return cfg;
}
内容来源于网络,如有侵权,请联系作者删除!