org.hibernate.cfg.ImprovedNamingStrategy Java Examples
The following examples show how to use
org.hibernate.cfg.ImprovedNamingStrategy.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LocalSessionFactoryBeanTests.java From spring4-understanding with Apache License 2.0 | 6 votes |
@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())); } }
Example #2
Source File: CreateDataBaseTableByHibernateConfigFile.java From base-framework with Apache License 2.0 | 5 votes |
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); }
Example #3
Source File: CreateTestInitializeDataBaseSqlFile.java From base-framework with Apache License 2.0 | 5 votes |
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); }