Persistence.createEntityManagerFactory清除整个数据库

我目前正在使用Hibernate + JPA的项目。 我不记得我在项目中确切改变了什么,但每当我尝试实例化一个新的EntityManagerFactory时,它都会清除数据库中的所有数据。 这是代码片段:
public abstract class GenericDAO<T> {

protected Class<T> t;
protected EntityManagerFactory managerFactory;
protected EntityManager manager;
protected Session hibernateSession;

public GenericDAO(Class<T> t) {
    this.t = t;
    this.managerFactory = Persistence.createEntityManagerFactory("hibernatePersistence");
    this.manager = this.managerFactory.createEntityManager();
    this.hibernateSession = HibernateUtil.getSessionFactory().openSession();
}
在包含“Persistence.createEntityManagerFactory(”hibernatePersistence“)”的行中,清除整个数据库。 我用尽了解决这个问题的每一个想法...我希望你们能帮忙。 提前致谢!     
已邀请:
在项目的某个地方寻找
hibernate.hbm2ddl.auto
属性(可能是
persistence.xml
文件)并将其删除或将其值更改为
validate
。也可以看看: http://docs.jboss.org/hibernate/core/3.3/reference/en/html/session-configuration.html#configuration-optional     
通过删除和创建全新的persistence.xml解决了这个问题。不知道为什么这个问题发生了,但是没关系,它现在有效......     

要回复问题请先登录注册