org.hibernate.HibernateException: Errors in named queries问题
2017-02-15 10:08
567 查看
org.hibernate.HibernateException: Errors in named queries问题解决方案:
1、从hibernate版本升级入手
2、配置的org.springframework.orm.hibernate3.LocalSessionFactoryBean中的hibernateProperties入手:
1、从hibernate版本升级入手
2、配置的org.springframework.orm.hibernate3.LocalSessionFactoryBean中的hibernateProperties入手:
<property name="hibernateProperties"> <props> <!-- <prop key="hibernate.hbm2ddl.auto">update</prop> --> <prop key="hibernate.dialect">org.hibernate.dialect.OracleDialect</prop> <prop key="hibernate.show_sql">true</prop> <prop key="hibernate.bytecode.use_reflection_optimizer">true</prop> <prop key="hibernate.cache.provider">org.hibernate.cache.EhCacheProvider</prop> <prop key="hibernate.cache.use_query_cache">true</prop> <prop key="hibernate.cache.use_second_level_cache">true</prop> <prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop> <prop key="hibernate.query.factory_class">org.hibernate.hql.ast.ASTQueryTranslatorFactory</prop> <prop key="hibernate.connection.setBigStringTryClob">true</prop> <prop key="connection.autoReconnect">true</prop> <prop key="connection.autoReconnectForPools">true</prop> <prop key="connection.is-connection-validation-required">true</prop> <!-- <prop key="hibernate.hbm2ddl.auto">validate | update | create | create-drop</prop> <prop key="hibernate.dialect">org.hibernate.dialect.DerbyDialect</prop> <prop key="hibernate.dialect">org.hibernate.dialect.OracleDialect</prop> <prop key="hibernate.jdbc.batch_size">50</prop> <prop key="hibernate.jdbc.fetch_Size">100</prop> --> </props> </property>3、从mappingLocations入手:
<property name="mappingLocations"> <list> <value>classpath*:/com/businessmatrix/**/entity/dbo/*.hbm.xml</value> <value>classpath*:/com/businessmatrix/auth/entity/dbo/nameQuery/NQ-auth.xml</value> </list> </property>总的配置:
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="lobHandler" ref="oracleLobHandle"/>
<property name="dataSource" ref="dataSource" />
<!-- <property name="mappingDirectoryLocations">-->
<!-- <property name="mappingLocations">
<list>
<value>classpath*:/com/businessmatrix/**/entity/dbo/*.hbm.xml</value>
</list>
</property>
<property name="mappingResources">
<list>
<value>com/businessmatrix/auth/entity/dbo/nameQuery/NQ-auth.xml</value>
</list>
</property> -->
<property name="mappingLocations"> <list> <value>classpath*:/com/businessmatrix/**/entity/dbo/*.hbm.xml</value> <value>classpath*:/com/businessmatrix/auth/entity/dbo/nameQuery/NQ-auth.xml</value> </list> </property>
<!-- <property name="mappingJarLocations">
<list>
<value>WEB-INF/lib/ips-auth20160309.jar</value>
</list>
</property> -->
<property name="hibernateProperties"> <props> <!-- <prop key="hibernate.hbm2ddl.auto">update</prop> --> <prop key="hibernate.dialect">org.hibernate.dialect.OracleDialect</prop> <prop key="hibernate.show_sql">true</prop> <prop key="hibernate.bytecode.use_reflection_optimizer">true</prop> <prop key="hibernate.cache.provider">org.hibernate.cache.EhCacheProvider</prop> <prop key="hibernate.cache.use_query_cache">true</prop> <prop key="hibernate.cache.use_second_level_cache">true</prop> <prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop> <prop key="hibernate.query.factory_class">org.hibernate.hql.ast.ASTQueryTranslatorFactory</prop> <prop key="hibernate.connection.setBigStringTryClob">true</prop> <prop key="connection.autoReconnect">true</prop> <prop key="connection.autoReconnectForPools">true</prop> <prop key="connection.is-connection-validation-required">true</prop> <!-- <prop key="hibernate.hbm2ddl.auto">validate | update | create | create-drop</prop> <prop key="hibernate.dialect">org.hibernate.dialect.DerbyDialect</prop> <prop key="hibernate.dialect">org.hibernate.dialect.OracleDialect</prop> <prop key="hibernate.jdbc.batch_size">50</prop> <prop key="hibernate.jdbc.fetch_Size">100</prop> --> </props> </property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<tx:annotation-driven transaction-manager="transactionManager" />
<!--
<tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true"/>
-->
<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
相关文章推荐
- org.hibernate.HibernateException: Errors in named queries解决
- 今天遇到了这样一个问题 Exception in thread "main" org.hibernate.LazyInitializationException: could not initiali
- org.hibernate.exception.SQLGrammarException:Could not execute JDBC batch update问题的解决
- org.hibernate.QueryException: addEntity() or addScalar() must be called on a sql query before executing the qury 问题的解决
- 在hql中使用left jion 遇到的问题 org.hibernate.hql.ast.QuerySyntaxException:
- hibernate实现jpa文档,persistence.xml配置问题(javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Canno
- Exception in thread "main" org.hibernate.PropertyAccessException: IllegalArgumentException occurred while calling setter of
- weblogic8.1中使用hibernate3的问题:CharScanner; panic: ClassNotFoundException: org.hibernate.hql.ast.HqlToken
- caused by org.hibernate.mappingexception repeated column in mapping for entity
- json解决hibernate中级联对象延迟加载问题net.sf.json.JSONException: org....
- org.hibernate.exception.SQLGrammarException:Could not execute JDBC batch update问题的解决
- org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'funcSetId' in 'class java.lang.Integer'
- org.hibernate.MappingException: Unknown entity常见问题
- 关于org.hibernate.ObjectNotFoundException: No row with the given identifier exists 的快捷解决问题
- org.hibernate.AssertionFailure: null id in xxx.xx.xx的问题
- hibernate问题详解:ClassNotFoundException: org.hibernate.hql.ast.HqlToken
- org.hibernate.MappingException Unknown entity com.po.Dept问题的解决
- 让初学者郁闷之极都问题!org.hibernate.hql.ast.QuerySyntaxException:
- spring3.0.5 和hibernate3.6整合问题之java.lang.ClassNotFoundException: org.objectweb.asm.Type
- SSH - org.hibernate.LazyInitializationException: could not initialize proxy - no Session问题解决办法