如何使用JPA和Hibernate在persistence.xml中只创建新表?

如何使用JPA和Hibernate在persistence.xml中只创建新表?,hibernate,jpa,persistence.xml,Hibernate,Jpa,Persistence.xml,我的persistence.xml文件如下所示: <?xml version="1.0" encoding="UTF-8"?> <persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://xmln

我的
persistence.xml
文件如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1"
    xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="
        http://xmlns.jcp.org/xml/ns/persistence
        http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
    <persistence-unit name="primary">
        <jta-data-source>java:jboss/datasources/LMSDS</jta-data-source>
        <properties>
            <property name="hibernate.event.merge.entity_copy_observer"
                value="allow" />
            <property name="hibernate.hbm2ddl.auto" value="create" />
            <property name="hibernate.show_sql" value="true" />
            <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
        </properties>
    </persistence-unit>
</persistence>

java:jboss/datasources/LMSDS
如果启动应用程序,则会创建表,因为
hibernate.hbm2ddl.auto
设置为
create
。如果我向应用程序添加新实体,我不希望数据库中的现有数据丢失,但我希望保留它,只创建新表


这是怎么可能的?

从今天起,使用Hibernate版本
这是不可能的您应该使用
更新
。还要看看这个答案:写出必要的模式更改:看看这个答案