如何使用hibernate.cfg.xml创建数据库架构 [英] how to create database schema with hibernate.cfg.xml

查看:61
本文介绍了如何使用hibernate.cfg.xml创建数据库架构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用

   < property name="hbm2ddl.auto"> create< / property >

仅创建表,并且每当模式不存在时,hibernate都无法创建表,因为该模式不存在.

only creates the tables, and whenever a schema does not exist, hibernate fails to create the table because the schema does not exist.

推荐答案

Hibernate不会为您创建模式,但是也许您可以告诉DBMS在hibernate开始创建模式对象之前运行一些脚本.我在此处找到了一些东西,我认为您可以以此为起点.

Hibernate will not create the schema for you, but maybe you can tell your DBMS to run some script before hibernate starts to create the schema objects. I found something here and I think you can use it as a start point.

这篇关于如何使用hibernate.cfg.xml创建数据库架构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆