有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java以编程方式创建实体管理器,无需持久性文件

我正在尝试以编程方式创建实体工厂管理器,而不使用持久性文件

    EntityManagerFactory emf;
    Map<String, String> properties = new HashMap<String, String>();
    properties.put("hibernate.connection.driver_class", "com.mysql.jdbc.Driver");
    properties.put("hibernate.connection.url", "jdbc:mysql://173.194.25***************");
    properties.put("hibernate.connection.username", "etech****");
    properties.put("hibernate.connection.password", "A*****");
    properties.put("hibernate.dialect", "org.hibernate.dialect.MySQLDialect");
    properties.put("hibernate.show-sql", "true");
    properties.put("provider", "org.hibernate.ejb.HibernatePersistence");
    emf = Persistence.createEntityManagerFactory(idClient, properties);

在线

emf = Persistence.createEntityManagerFactory(idClient, properties);

我得到了一个错误:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com****RepositoryFieldsFieldWorkerRepositoryImpl': Invocation of init method failed; nested exception is javax.persistence.PersistenceException: No Persistence provider for EntityManager named idClient

如何解决这个问题

任何帮助都将不胜感激


共 (1) 个答案