---
title: "hibernate从POJO创建数据库表"
author: "wyyl00"
date: "2010-07-19T23:52:21Z"
tags: ["Hibernate", "SQL", "XML"]
categories: ["企业架构"]
slug: "hibernate-pojo"
draft: false
lastmod: "2010-07-19T23:52:21Z"
id: 716548
url: "https://aryanwang.iteye.com/blog/716548"
---

```
Configuration config = new Configuration().configure();
SchemaExport se =  new SchemaExport(config);
se.setOutputFile("E:\\sql.txt");//保存建表语句
se.create(true, false);//第一个参数为是否显示建表语句，第二个为是否在创建表之前删除同名表
```

 当然，得先配置好hibernate.cfg.xml以及相应的POJO和\*\*.hbm..xml文件。