我正在創建一個使用JPA註釋模型 - 核心模型 - 的Java應用程序。在這些實體之上,在運行時,我想從包含其他一些JPA類定義和映射的外部源添加一個jar文件。導入的歸檔文件可能會更改其類結構和映射,但應用程序有義務在更改時刷新整個模式。Hibernate動態實體模型
但是,嘗試添加的jar到Hibernate配置的時候,我得到一個
org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
內部異常有關休眠方言:
org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
不過,我肯定有指定persistence.xml
文件中的hibernate.dialect
屬性。以下是我在我的應用程序中使用的代碼:
org.hibernate.cfg.Configuration cfg = new org.hibernate.cfg.Configuration();
cfg.addJar(new File("path/to/jar.jar"));
cfg.buildSessionFactory();
我在做什麼錯?
另外,如果您發現這是一種創建多個應用程序之間共享的動態可更新模式的好方法,請告訴我嗎?