@Test
public void testSchemaExport() {
ServiceRegistry serviceRegistry =
new StandardServiceRegistryBuilder().configure().build();
MetadataImplementor metadataImplementor =
(MetadataImplementor) new MetadataSources(serviceRegistry).buildMetadata();
SchemaExport schemaExport = new SchemaExport(serviceRegistry, metadataImplementor);
schemaExport.create(true, true);
}
java类org.hibernate.tool.hbm2ddl.SchemaExport的实例源码
HQLTest.java 文件源码
项目:personal
阅读 32
收藏 0
点赞 0
评论 0
ORMappingTest.java 文件源码
项目:personal
阅读 25
收藏 0
点赞 0
评论 0
@Test
public void testSchemaExport() {
ServiceRegistry serviceRegistry =
new StandardServiceRegistryBuilder().configure().build();
MetadataImplementor metadataImplementor =
(MetadataImplementor) new MetadataSources(serviceRegistry).buildMetadata();
SchemaExport schemaExport = new SchemaExport(serviceRegistry, metadataImplementor);
schemaExport.create(true, true);
}
ORMappingTest.java 文件源码
项目:personal
阅读 29
收藏 0
点赞 0
评论 0
@Test
public void testSchemaExport() {
ServiceRegistry serviceRegistry =
new StandardServiceRegistryBuilder().configure().build();
MetadataImplementor metadataImplementor =
(MetadataImplementor) new MetadataSources(serviceRegistry).buildMetadata();
SchemaExport schemaExport = new SchemaExport(serviceRegistry, metadataImplementor);
schemaExport.create(true, true);
}
TransactionTest.java 文件源码
项目:personal
阅读 26
收藏 0
点赞 0
评论 0
@Test
public void testSchemaExport() {
ServiceRegistry serviceRegistry =
new StandardServiceRegistryBuilder().configure().build();
MetadataImplementor metadataImplementor =
(MetadataImplementor) new MetadataSources(serviceRegistry).buildMetadata();
SchemaExport schemaExport = new SchemaExport(serviceRegistry, metadataImplementor);
schemaExport.create(true, true);
}
ORMappingTest.java 文件源码
项目:personal
阅读 24
收藏 0
点赞 0
评论 0
@Test
public void testSchemaExport() {
ServiceRegistry serviceRegistry =
new StandardServiceRegistryBuilder().configure().build();
MetadataImplementor metadataImplementor =
(MetadataImplementor) new MetadataSources(serviceRegistry).buildMetadata();
SchemaExport schemaExport = new SchemaExport(serviceRegistry, metadataImplementor);
schemaExport.create(true, true);
}
ORMappingTest.java 文件源码
项目:personal
阅读 27
收藏 0
点赞 0
评论 0
@Test
public void testSchemaExport() {
ServiceRegistry serviceRegistry =
new StandardServiceRegistryBuilder().configure().build();
MetadataImplementor metadataImplementor =
(MetadataImplementor) new MetadataSources(serviceRegistry).buildMetadata();
SchemaExport schemaExport = new SchemaExport(serviceRegistry, metadataImplementor);
schemaExport.create(true, true);
}
ORMappingTest.java 文件源码
项目:personal
阅读 26
收藏 0
点赞 0
评论 0
@Test
public void testSchemaExport() {
ServiceRegistry serviceRegistry =
new StandardServiceRegistryBuilder().configure().build();
MetadataImplementor metadataImplementor =
(MetadataImplementor) new MetadataSources(serviceRegistry).buildMetadata();
SchemaExport schemaExport = new SchemaExport(serviceRegistry, metadataImplementor);
schemaExport.create(true, true);
}
TestSchemaTools.java 文件源码
项目:cacheonix-core
阅读 25
收藏 0
点赞 0
评论 0
public void testSchemaTools() throws Exception{
// database schema have been created thanks to the setUp method
// we have 2 schemas SA et SB, SB must be set as the default schema
// used by hibernate hibernate.default_schema SB
SchemaExport se = new SchemaExport(getCfg());
se.create(true,true);
// here we modify the generated table in order to test SchemaUpdate
Session session = openSession();
Connection conn = session.connection();
Statement stat = conn.createStatement();
stat.execute("ALTER TABLE \"SB\".\"Team\" DROP COLUMN name ");
// update schema
SchemaUpdate su = new SchemaUpdate(getCfg());
su.execute(true,true);
// we can run schema validation. Note that in the setUp method a *wrong* table
// has been created with different column names
// if schema validator chooses the bad db schema, then the testcase will fail (exception)
SchemaValidator sv = new SchemaValidator(getCfg());
sv.validate();
// it's time to clean our database
se.drop(true,true);
// then the schemas and false table.
stat.execute("DROP TABLE \"SA\".\"Team\" ");
stat.execute(" DROP SCHEMA sa ");
stat.execute("DROP SCHEMA sb ");
stat.close();
session.close();
}
TestSchemaTools.java 文件源码
项目:cacheonix-core
阅读 27
收藏 0
点赞 0
评论 0
public void testSchemaToolsNonQuote() throws Exception{
// database schema have been created thanks to the setUp method
// we have 2 schemas SA et SB, SB must be set as the default schema
// used by hibernate hibernate.default_schema SB
SchemaExport se = new SchemaExport(getCfg());
se.create(true,true);
// here we modify the generated table in order to test SchemaUpdate
Session session = openSession();
Connection conn = session.connection();
Statement stat = conn.createStatement();
stat.execute("ALTER TABLE \"SB\".\"TEAM\" DROP COLUMN xname ");
// update schema
SchemaUpdate su = new SchemaUpdate(getCfg());
su.execute(true,true);
// we can run schema validation. Note that in the setUp method a *wrong* table
// has been created with different column names
// if schema validator chooses the bad db schema, then the testcase will fail (exception)
SchemaValidator sv = new SchemaValidator(getCfg());
sv.validate();
// it's time to clean our database
se.drop(true,true);
// then the schemas and false table.
stat.execute("DROP TABLE \"SA\".\"Team\" ");
stat.execute(" DROP SCHEMA sa ");
stat.execute("DROP SCHEMA sb ");
stat.close();
session.close();
}
TestSchemaTools.java 文件源码
项目:cacheonix-core
阅读 20
收藏 0
点赞 0
评论 0
public void testFailingQuoteValidation() throws Exception{
// database schema have been created thanks to the setUp method
// we have 2 schemas SA et SB, SB must be set as the default schema
// used by hibernate hibernate.default_schema SB
SchemaExport se = new SchemaExport(getCfg());
se.create(true,true);
// here we modify the generated table in order to test SchemaUpdate
Session session = openSession();
Connection conn = session.connection();
Statement stat = conn.createStatement();
stat.execute("ALTER TABLE \"SB\".\"Team\" DROP COLUMN name ");
// update schema
//SchemaUpdate su = new SchemaUpdate(getCfg());
//su.execute(true,true);
try {
SchemaValidator sv = new SchemaValidator(getCfg());
sv.validate();
fail("should fail since we mutated the current schema.");
} catch(HibernateException he) {
}
// it's time to clean our database
se.drop(true,true);
// then the schemas and false table.
stat.execute("DROP TABLE \"SA\".\"Team\" ");
stat.execute(" DROP SCHEMA sa ");
stat.execute("DROP SCHEMA sb ");
stat.close();
session.close();
}