> For the complete documentation index, see [llms.txt](https://jack80342.gitbook.io/spring-boot/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jack80342.gitbook.io/spring-boot/iv.-spring-boot-features/29.-working-with-sql-databases/29.3.-jpa-and-spring-data/29.3.3.-creating-and-dropping-jpa-databases.md).

# 29.3.3. 创建和删除JPA数据库

默认情况下，只有在你使用内嵌数据库（H2, HSQL或Derby）时，JPA数据库才会被自动创建。你可以使用`spring.jpa.*`属性显式的设置JPA，比如，将以下配置添加到`application.properties`中可以创建和删除表：

```
spring.jpa.hibernate.ddl-auto=create-drop
```

**注** Hibernate自己内部对创建，删除表支持的属性是`hibernate.hbm2ddl.auto`（如果你记得更好）。你可以使用`spring.jpa.properties.*`设置Hibernate其他的native属性（前缀在被添加到实体管理器之前会被去掉）。下面是给Hibernate设置JPA属性的例子：

```
`spring.jpa.properties.hibernate.globally_quoted_identifiers=true`
```

上面的例子将`true`传递到Hibernate实体管理器里的`hibernate.globally_quoted_identifiers`属性。

通常，DDL执行（或验证）被延迟到`ApplicationContext`启动后，这可以通过`spring.jpa.generate-ddl`标签控制，如果Hibernate自动配置被激活，那该标识就不会被使用，因为`ddl-auto`设置粒度更细。
