在HSQLDB中创建架构的启动脚本

在HSQLDB中创建架构的启动脚本,第1张

在HSQLDB中创建架构的启动脚本

如果您以这种方式运行脚本…

<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jdbc="http://www.springframework.org/schema/jdbc"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd        http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd"><jdbc:embedded-database id="dataSource" type="H2" >    <jdbc:script location="classpath:my.sql" />     </jdbc:embedded-database>

…然后在Hibernate进行初始化工作之前执行它。


我再次测试了它,特别是对您来说。它在Hibernate创建表之前运行。请参阅以下日志( 在前三行中运行脚本,在最后三行中运行Hibernate ):

2011-11-01 19:10:08,380 [main] INFO  org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseFactory - Creating embedded database 'dataSource'2011-11-01 19:10:08,583 [main] INFO  org.springframework.jdbc.datasource.init.ResourceDatabasePopulator - Executing SQL script from class path resource [my.sql]2011-11-01 19:10:08,683 [main] INFO  org.springframework.jdbc.datasource.init.ResourceDatabasePopulator - Done executing SQL script from class path resource [my.sql] in 100 ms.2011-11-01 19:10:08,683 [main] INFO  org.springframework.context.support.GenericApplicationContext - Bean 'dataSource' of type [class org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)2011-11-01 19:10:08,683 [main] INFO  org.springframework.context.support.GenericApplicationContext - Bean 'dataSource' of type [class org.springframework.jdbc.datasource.SimpleDriverDataSource] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)2011-11-01 19:10:08,700 [main] INFO  org.springframework.context.support.GenericApplicationContext - Bean 'org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter#35712651' of type [class org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)2011-11-01 19:10:08,717 [main] INFO  org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean - Building JPA container EntityManagerFactory for persistence unit 'testH2DbPersistenceUnit'2011-11-01 19:10:08,854 [main] INFO  org.hibernate.annotations.common.Version - Hibernate Commons Annotations 3.2.0.Final2011-11-01 19:10:08,859 [main] INFO  org.hibernate.cfg.Environment - Hibernate 3.6.7.Final2011-11-01 19:10:08,861 [main] INFO  org.hibernate.cfg.Environment - hibernate.properties not found...2011-11-01 19:10:10,313 [main] INFO  org.hibernate.tool.hbm2ddl.SchemaUpdate - Running hbm2ddl schema update2011-11-01 19:10:10,313 [main] INFO  org.hibernate.tool.hbm2ddl.SchemaUpdate - fetching database metadata2011-11-01 19:10:10,315 [main] INFO  org.hibernate.tool.hbm2ddl.SchemaUpdate - updating schema


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5027730.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-11-15
下一篇 2022-11-15

发表评论

登录后才能评论

评论列表(0条)

保存