2017-04-16 11 views
0

のIntelliJでJHipster 4.2.0を使用してJPAコンソールが動作していない:アプリケーション-dev.yml factory_classが設定されているJHipsterやIntelliJのJPAコンソール

javax.persistence.PersistenceException: [PersistenceUnit: Entities] Unable to build Hibernate SessionFactory 
java.lang.RuntimeException: org.hibernate.cache.NoCacheRegionFactoryAvailableException: Second-level cache is used in the application, but property hibernate.cache.region.factory_class is not given; please either disable second level cache or set correct region factory using the hibernate.cache.region.factory_class setting and make sure the second level cache provider (hibernate-infinispan, e.g.) is available on the classpath. 

ながら。

hibernate.cache.region.factory_class: io.github.jhipster.config.jcache.NoDefaultJCacheRegionFactory 

これを解決する方法はありますか。

+0

これは通常、springプロファイルをdevに設定せず、IJ設定を確認したときに発生します。 –

+0

実行/デバッグ構成とMavenプロファイルでspring開発者プロファイルを設定しましたが、jpaコンソール用に設定する方法はわかりません。 – dbConn

+0

JPAコンソールはUltimate Editionの機能であり、JetBrainsのサポートを依頼しましたか?このhttps://www.jetbrains.com/help/idea/2017.1/working-with-the-jpa-console.html#d469049e34 –

答えて

0

私のソリューションは、リソースフォルダにこのpersistence.xmlファイルを作成することでしたが、あなたはあなたのニーズに合わせて修正する必要があり、私の場合、私はPostgresSQLのを使用していますが、あなたのデータの基本型で設定できるの:

<?xml version="1.0" encoding="UTF-8"?> 
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> 
    <persistence-unit name="project name" transaction-type="RESOURCE_LOCAL"> 
     <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider> 
     <!-- non-jta-datasource>jdbc/arquillian</non-jta-datasource --> 
     <properties> 
      <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQL9Dialect"/> 
      <property name="hibernate.cache.use_second_level_cache" value="true"/> 
      <property name="hibernate.cache.use_query_cache" value="false"/> 
      <property name="hibernate.show_sql" value="true"/> 
      <property name="hibernate.format_sql" value="true"/> 
      <property name="hibernate.use_sql_comments" value="false"/> 
      <property name="hibernate.generate_statistics" value="true"/> 
      <property name="hibernate.cache.region.factory_class" value="org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory"/> 
      <property name="javax.persistence.jdbc.url" value="jdbc:postgresql://localhost:5432/dialysis-dev"/> 
      <property name="javax.persistence.jdbc.user" value="develop"/> 
      <property name="javax.persistence.jdbc.password" value="admpostgres"/> 
      <property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver"/> 
      <property name="hibernate.ejb.naming_strategy" value="org.springframework.boot.orm.jpa.hibernate.SpringNamingStrategy"/> 
      <property name="hibernate.ddl-auto" value="none"/> 
     </properties> 
    </persistence-unit> 
</persistence> 

次に、表示メニュー/ツールのWindows/Persistenceでこの永続性ファイルを見ることができます。右クリックすると、JPAコンソールが表示されます。私の場合は完璧に動作します。

IntelliJ IDEAに必要なすべての設定が上記のファイルに含まれているため、この方法でデータソースを割り当てる必要はありません。ところで、これはIntellij IDEAのUltimateバージョンでテストされました。

関連する問題