当前位置: 首页>>代码示例>>Java>>正文


Java ImprovedNamingStrategy类代码示例

本文整理汇总了Java中org.hibernate.cfg.ImprovedNamingStrategy的典型用法代码示例。如果您正苦于以下问题:Java ImprovedNamingStrategy类的具体用法?Java ImprovedNamingStrategy怎么用?Java ImprovedNamingStrategy使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ImprovedNamingStrategy类属于org.hibernate.cfg包,在下文中一共展示了ImprovedNamingStrategy类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testLocalSessionFactoryBeanWithNamingStrategy

import org.hibernate.cfg.ImprovedNamingStrategy; //导入依赖的package包/类
@Test
@SuppressWarnings("serial")
public void testLocalSessionFactoryBeanWithNamingStrategy() throws Exception {
	LocalSessionFactoryBean sfb = new LocalSessionFactoryBean() {
		@Override
		protected Configuration newConfiguration() {
			return new Configuration() {
				@Override
				public Configuration setNamingStrategy(NamingStrategy namingStrategy) {
					throw new IllegalArgumentException(namingStrategy.toString());
				}
			};
		}
	};
	sfb.setMappingResources(new String[0]);
	sfb.setDataSource(new DriverManagerDataSource());
	sfb.setNamingStrategy(ImprovedNamingStrategy.INSTANCE);
	try {
		sfb.afterPropertiesSet();
		fail("Should have thrown IllegalArgumentException");
	}
	catch (IllegalArgumentException ex) {
		// expected
		assertTrue("Correct exception", ex.getMessage().equals(ImprovedNamingStrategy.INSTANCE.toString()));
	}
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:27,代码来源:LocalSessionFactoryBeanTests.java

示例2: entityManagerFactory

import org.hibernate.cfg.ImprovedNamingStrategy; //导入依赖的package包/类
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() throws Exception {
	LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();

	entityManagerFactoryBean.setDataSource(dataSource());
	entityManagerFactoryBean.setPackagesToScan("com.github.kmbulebu.nicknack.server.model");
	entityManagerFactoryBean.setPersistenceProviderClass(HibernatePersistenceProvider.class);


	Properties jpaProperties = new Properties();

	jpaProperties.put(PROPERTY_NAME_HIBERNATE_DIALECT, org.hibernate.dialect.H2Dialect.class.getName());
	jpaProperties.put(PROPERTY_NAME_HIBERNATE_FORMAT_SQL, "true");
	jpaProperties.put(PROPERTY_NAME_HIBERNATE_NAMING_STRATEGY, ImprovedNamingStrategy.class.getName());
	jpaProperties.put(PROPERTY_NAME_HIBERNATE_SHOW_SQL, "false");
	jpaProperties.put(PROPERTY_NAME_HIBERNATE_HBM2DDL_AUTO, "update");

	entityManagerFactoryBean.setJpaProperties(jpaProperties);

	return entityManagerFactoryBean;
}
 
开发者ID:kmbulebu,项目名称:NickNack,代码行数:22,代码来源:H2DatabaseConfiguration.java

示例3: main

import org.hibernate.cfg.ImprovedNamingStrategy; //导入依赖的package包/类
public static void main(String[] args) {
	Ejb3Configuration ejb3Cfg = new Ejb3Configuration();
	
	// set propeties (these were set based on the persistence.xml file)
	Properties props = new Properties();
	props.put("hibernate.dialect", "org.hibernate.dialect.MySQLDialect");
	ejb3Cfg.addProperties(props);
	
	ejb3Cfg.setNamingStrategy(ImprovedNamingStrategy.INSTANCE);
	
	// add annotated classes
	ejb3Cfg.addAnnotatedClass(EndUser.class);
	ejb3Cfg.addAnnotatedClass(Individual.class);
	ejb3Cfg.addAnnotatedClass(Location.class);
	ejb3Cfg.addAnnotatedClass(SocialGroup.class);
	ejb3Cfg.addAnnotatedClass(Visit.class);
	
	Configuration cfg = ejb3Cfg.getHibernateConfiguration();
	
	SchemaExport se = new SchemaExport(cfg).setOutputFile(RESOURCES_PATH + "specialstudy-schema-ddl.sql");
	se.execute(false, false, false, true);
}
 
开发者ID:OpenHDS,项目名称:openhds-server,代码行数:23,代码来源:Ejb3SchemaExport.java

示例4: buildSessionFactoryFromAnnotations

import org.hibernate.cfg.ImprovedNamingStrategy; //导入依赖的package包/类
public static SessionFactory buildSessionFactoryFromAnnotations()
{
    try
    {
        sessionFactory = new AnnotationConfiguration()
                    .setNamingStrategy(ImprovedNamingStrategy.INSTANCE)
                    .configure("/hib.cfg.xml")
                    .buildSessionFactory();
        return sessionFactory;
    }
    catch (Throwable ex)
    {
        throw new ExceptionInInitializerError(ex);
    }
}
 
开发者ID:windup,项目名称:windup-rulesets,代码行数:16,代码来源:HibernateUtil.java

示例5: main

import org.hibernate.cfg.ImprovedNamingStrategy; //导入依赖的package包/类
public static void main(String[] args) {
	Configuration configuration = new Configuration().configure().setNamingStrategy(new ImprovedNamingStrategy());
	EnversSchemaGenerator generator = new EnversSchemaGenerator(configuration);
	SchemaExport export = generator.export();
	
	export.setFormat(false);
	export.setOutputFile("src/test/resources/data/h2/create-table-new.sql");
	export.create(true, false);
}
 
开发者ID:extion,项目名称:base-framework,代码行数:10,代码来源:CreateDataBaseTableByHibernateConfigFile.java

示例6: main

import org.hibernate.cfg.ImprovedNamingStrategy; //导入依赖的package包/类
public static void main(String[] args) {
	
	Configuration configuration = new Configuration().configure().setNamingStrategy(new ImprovedNamingStrategy());
	EnversSchemaGenerator generator = new EnversSchemaGenerator(configuration);
	SchemaExport export = generator.export();
	
	export.setFormat(false);
	export.setOutputFile("src/test/resources/h2schma.sql");
	export.create(true, false);
}
 
开发者ID:extion,项目名称:base-framework,代码行数:11,代码来源:CreateTestInitializeDataBaseSqlFile.java

示例7: improvedNaming_ClassToTableName

import org.hibernate.cfg.ImprovedNamingStrategy; //导入依赖的package包/类
@Test
public void improvedNaming_ClassToTableName() {
    ImprovedNamingStrategy namingStrategy = new ImprovedNamingStrategy();

    for (int i = 0; i < classNames.length; i++) {
        String tableName = namingStrategy.classToTableName(classNames[i]);
        assertThat(tableName).isEqualTo(tableNames[i]);
    }
}
 
开发者ID:debop,项目名称:hibernate-examples,代码行数:10,代码来源:OracleNamingStrategyTest.java

示例8: improvedNaming_PropertyToColumnName

import org.hibernate.cfg.ImprovedNamingStrategy; //导入依赖的package包/类
@Test
public void improvedNaming_PropertyToColumnName() {
    ImprovedNamingStrategy namingStrategy = new ImprovedNamingStrategy();

    for (int i = 0; i < propertyNames.length; i++) {
        final String columnName = namingStrategy.propertyToColumnName(propertyNames[i]);
        assertThat(columnName).isEqualTo(columnNames[i]);
    }
}
 
开发者ID:debop,项目名称:hibernate-examples,代码行数:10,代码来源:OracleNamingStrategyTest.java

示例9: improvedNaming_ClassToTableName

import org.hibernate.cfg.ImprovedNamingStrategy; //导入依赖的package包/类
@Test
public void improvedNaming_ClassToTableName() {
    ImprovedNamingStrategy improvedNamingStrategy = new ImprovedNamingStrategy();

    for (int i = 0; i < classNames.length; i++) {
        Assert.assertEquals(tableNames[i],
                            improvedNamingStrategy.classToTableName(classNames[i]));
    }
}
 
开发者ID:debop,项目名称:debop4j,代码行数:10,代码来源:OracleNamingStrategyTest.java

示例10: improvedNaming_PropertyToColumnName

import org.hibernate.cfg.ImprovedNamingStrategy; //导入依赖的package包/类
@Test
public void improvedNaming_PropertyToColumnName() {
    ImprovedNamingStrategy improvedNamingStrategy = new ImprovedNamingStrategy();

    for (int i = 0; i < propertyNames.length; i++) {
        Assert.assertEquals(columnNames[i],
                            improvedNamingStrategy.propertyToColumnName(propertyNames[i]));
    }
}
 
开发者ID:debop,项目名称:debop4j,代码行数:10,代码来源:OracleNamingStrategyTest.java

示例11: testSuccessGetResultSetStatementImprovedNamingStrategyJava

import org.hibernate.cfg.ImprovedNamingStrategy; //导入依赖的package包/类
@Test
public void testSuccessGetResultSetStatementImprovedNamingStrategyJava() {
	interpretedClass = InterpretedClassFactory.getInterpretedClass(ExampleModel.class);
	resultSetStatement = new ResultSetStatement(interpretedClass, new ImprovedNamingStrategy());
	assertEquals(Results.resultSetStringImprovedNamingStrategy, resultSetStatement.getStatement());
}
 
开发者ID:ralphavalon,项目名称:statement-generator,代码行数:7,代码来源:ResultSetStatementTest.java

示例12: testSuccessGetResultSetStatementImprovedNamingStrategyClass

import org.hibernate.cfg.ImprovedNamingStrategy; //导入依赖的package包/类
@Test
public void testSuccessGetResultSetStatementImprovedNamingStrategyClass() {
	interpretedClass = InterpretedClassFactory.getInterpretedClass(ExampleModel.class);
	resultSetStatement = new ResultSetStatement(interpretedClass, new ImprovedNamingStrategy());
	assertEquals(Results.resultSetStringImprovedNamingStrategy, resultSetStatement.getStatement());
}
 
开发者ID:ralphavalon,项目名称:statement-generator,代码行数:7,代码来源:ResultSetStatementTest.java

示例13: testSuccessGetStatementImprovedNamingStrategyJava

import org.hibernate.cfg.ImprovedNamingStrategy; //导入依赖的package包/类
@Test
public void testSuccessGetStatementImprovedNamingStrategyJava() {
	interpretedClass = InterpretedClassFactory.getInterpretedClass(ExampleModel.class);
	statement = new UpdateSQLStatement(interpretedClass, new ImprovedNamingStrategy());
	assertEquals(Results.updateSQLStatementStringImprovedNamingStrategy, statement.getStatement());
}
 
开发者ID:ralphavalon,项目名称:statement-generator,代码行数:7,代码来源:UpdateSQLStatementTest.java

示例14: testSuccessGetStatementImprovedNamingStrategyClass

import org.hibernate.cfg.ImprovedNamingStrategy; //导入依赖的package包/类
@Test
public void testSuccessGetStatementImprovedNamingStrategyClass() {
	interpretedClass = InterpretedClassFactory.getInterpretedClass(getJavaClass());
	statement = new UpdateSQLStatement(interpretedClass, new ImprovedNamingStrategy());
	assertEquals(Results.updateSQLStatementStringImprovedNamingStrategy, statement.getStatement());
}
 
开发者ID:ralphavalon,项目名称:statement-generator,代码行数:7,代码来源:UpdateSQLStatementTest.java

示例15: testSuccessGetStatementImprovedNamingStrategyJava

import org.hibernate.cfg.ImprovedNamingStrategy; //导入依赖的package包/类
@Test
public void testSuccessGetStatementImprovedNamingStrategyJava() {
	interpretedClass = InterpretedClassFactory.getInterpretedClass(ExampleModel.class);
	statement = new InsertSQLStatement(interpretedClass, new ImprovedNamingStrategy());
	assertEquals(Results.insertSQLStatementStringImprovedNamingStrategy, statement.getStatement());
}
 
开发者ID:ralphavalon,项目名称:statement-generator,代码行数:7,代码来源:InsertSQLStatementTest.java


注:本文中的org.hibernate.cfg.ImprovedNamingStrategy类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。