Hibernate使用JPA(注释实体)和liquibase [英] Hibernate using JPA (annotated Entities) and liquibase
问题描述
hibernate:classic:com / example / hibernate.cfg.xml
如果您有hibernate xml conf文件或
hibernate:ejb3:myPersistenceUnit
如果您有META -INF / persistence.xml,或者
hibernate:spring:com.example?dialect = org.hibernate.dialect.MySQL5Dialect
如果您想根据包含注释实体的java包自动生成JPA配置。
liquibase is a perfect alternative to hibernate's hbm2ddl_auto property if you are using xml-mapping. But Im using JPA annotation (hibernate annotations). Is it possible to use liquibase then?
Yes, Liquibase uses hibernate's metadata classes, which are the same whether you use xml mappings or annotations. You do need a hibernate config file to point liquibase to, but your mappings can be xml or jpa annotations. More information can be found at https://github.com/liquibase/liquibase-hibernate/wiki but you can use "database urls" such as
hibernate:classic:com/example/hibernate.cfg.xml
if you have a hibernate xml conf file or
hibernate:ejb3:myPersistenceUnit
if you have a META-INF/persistence.xml, or
hibernate:spring:com.example?dialect=org.hibernate.dialect.MySQL5Dialect
if you would like auto-generate a JPA configuration based on a java package containing annotated Entities.
这篇关于Hibernate使用JPA(注释实体)和liquibase的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!