Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/hibernate/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/139.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java sessionFactory的bean中的name属性位于';红色';在IDEA中,即无法解析属性_Java_Hibernate_Spring_Intellij Idea - Fatal编程技术网

Java sessionFactory的bean中的name属性位于';红色';在IDEA中,即无法解析属性

Java sessionFactory的bean中的name属性位于';红色';在IDEA中,即无法解析属性,java,hibernate,spring,intellij-idea,Java,Hibernate,Spring,Intellij Idea,我的app-config.xml看起来像: <!-- Hibernate SessionFactory --> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> <property name="dataSource" ref="dataSource"/> <

我的app-config.xml看起来像:

 <!-- Hibernate SessionFactory -->
  <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
      <property name="dataSource" ref="dataSource"/>
      <!--<property name="configLocation" value="classpath:hibernate.cfg.xml"/>      -->
      <property name="hibernateProperties">
          <value>
              hibernate.dialect=org.hibernate.dialect.MySQLDialect
              hibernate.connection.url=jdbc:mysql://localhost/mydb
              hibernate.connection.username=devuser
              hibernate.connection.password=devpwd
              hibernate.query.substitutions=true 'Y', false 'N'
              hibernate.cache.use_query_cache=true
              hibernate.cache.use_second_level_cache=true
              hibernate.cache.provider_class=org.hibernate.cache.EhCacheProvider
              hibernate.jdbc.batch_size=0
          </value>
      </property>
  </bean>

  <!-- Transaction manager for a single Hibernate SessionFactory (alternative to JTA) -->
  <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
      <property name="sessionFactory" ref="sessionFactory"/>
  </bean>


   <bean id="userDao" class="com.blah.core.db.hibernate.UserDaoImpl">
      <property name="sessionFactory" ref="sessionFactory"/>
  </bean>

 <!-- Hibernate SessionFactory -->
  <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
      <property name="dataSource" ref="dataSource"/>
      <!--<property name="configLocation" value="classpath:hibernate.cfg.xml"/>      -->
      <property name="hibernateProperties">
          <value>
              hibernate.dialect=org.hibernate.dialect.MySQLDialect
              hibernate.connection.url=jdbc:mysql://localhost/mydb
              hibernate.connection.username=devuser
              hibernate.connection.password=devpwd
              hibernate.query.substitutions=true 'Y', false 'N'
              hibernate.cache.use_query_cache=true
              hibernate.cache.use_second_level_cache=true
              hibernate.cache.provider_class=org.hibernate.cache.EhCacheProvider
              hibernate.jdbc.batch_size=0
          </value>
      </property>
  </bean>

  <!-- Transaction manager for a single Hibernate SessionFactory (alternative to JTA) -->
  <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
      <property name="sessionFactory" ref="sessionFactory"/>
  </bean>


   <bean id="userDao" class="com.blah.core.db.hibernate.UserDaoImpl">
      <property name="sessionFactory" ref="sessionFactory"/>
  </bean>

hibernate.dialogue=org.hibernate.dialogue.mysqldialogue
hibernate.connection.url=jdbc:mysql://localhost/mydb
hibernate.connection.username=devuser
hibernate.connection.password=devpwd
hibernate.query.substitutions=true“Y”,false“N”
hibernate.cache.use\u query\u cache=true
hibernate.cache.use_second_level_cache=true
hibernate.cache.provider\u class=org.hibernate.cache.EhCacheProvider
hibernate.jdbc.batch\u size=0
线路
原因可能是什么?

我在Intellij Idea中加载了它,没有看到名称属性的红色,包括取消对configLocation属性的注释

 <!-- Hibernate SessionFactory -->
  <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
      <property name="dataSource" ref="dataSource"/>
      <!--<property name="configLocation" value="classpath:hibernate.cfg.xml"/>      -->
      <property name="hibernateProperties">
          <value>
              hibernate.dialect=org.hibernate.dialect.MySQLDialect
              hibernate.connection.url=jdbc:mysql://localhost/mydb
              hibernate.connection.username=devuser
              hibernate.connection.password=devpwd
              hibernate.query.substitutions=true 'Y', false 'N'
              hibernate.cache.use_query_cache=true
              hibernate.cache.use_second_level_cache=true
              hibernate.cache.provider_class=org.hibernate.cache.EhCacheProvider
              hibernate.jdbc.batch_size=0
          </value>
      </property>
  </bean>

  <!-- Transaction manager for a single Hibernate SessionFactory (alternative to JTA) -->
  <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
      <property name="sessionFactory" ref="sessionFactory"/>
  </bean>


   <bean id="userDao" class="com.blah.core.db.hibernate.UserDaoImpl">
      <property name="sessionFactory" ref="sessionFactory"/>
  </bean>
您可能需要检查是否在Intellij中配置了正确版本的库,因为name属性似乎与库类中的字段不匹配,特别是您正在使用的AnnotationSessionFactoryBean

 <!-- Hibernate SessionFactory -->
  <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
      <property name="dataSource" ref="dataSource"/>
      <!--<property name="configLocation" value="classpath:hibernate.cfg.xml"/>      -->
      <property name="hibernateProperties">
          <value>
              hibernate.dialect=org.hibernate.dialect.MySQLDialect
              hibernate.connection.url=jdbc:mysql://localhost/mydb
              hibernate.connection.username=devuser
              hibernate.connection.password=devpwd
              hibernate.query.substitutions=true 'Y', false 'N'
              hibernate.cache.use_query_cache=true
              hibernate.cache.use_second_level_cache=true
              hibernate.cache.provider_class=org.hibernate.cache.EhCacheProvider
              hibernate.jdbc.batch_size=0
          </value>
      </property>
  </bean>

  <!-- Transaction manager for a single Hibernate SessionFactory (alternative to JTA) -->
  <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
      <property name="sessionFactory" ref="sessionFactory"/>
  </bean>


   <bean id="userDao" class="com.blah.core.db.hibernate.UserDaoImpl">
      <property name="sessionFactory" ref="sessionFactory"/>
  </bean>