java - Hibernate 4 Multi-tenancy Issue - No Entity Persisters Found -
i have been trying integrate hibernate 4 multi-tenancy support in our application below exception on executing hql query
java.lang.arrayindexoutofboundsexception: 0 @ org.hibernate.jpa.spi.abstractentitymanagerimpl.resultclasschecking(abstractentitymanagerimpl.java:362) @ org.hibernate.jpa.spi.abstractentitymanagerimpl.createquery(abstractentitymanagerimpl.java:344) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:62) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ org.springframework.orm.jpa.extendedentitymanagercreator$extendedentitymanagerinvocationhandler.invoke(extendedentitymanagercreator.java:344) @ com.sun.proxy.$proxy288.createquery(unknown source) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:62) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ org.springframework.orm.jpa.sharedentitymanagercreator$sharedentitymanagerinvocationhandler.invoke(sharedentitymanagercreator.java:291) @ com.sun.proxy.$proxy43.createquery(unknown source)
the hql query -
list<field> fields = entitymanager.createquery("from " + employee.class.getname() + " " + getqueryforinclause("id", ids), employee.class).getresultlist();
on debugging hibernate source, realize because hibernate's sessionfactory instance not have entitypersister instances due hql query have translator's.
is because entity beans not getting scanned? if cause?
the entityfactory spring declared below
<property name="persistenceproviderclass" value="org.hibernate.jpa.hibernatepersistenceprovider"/> <property name="persistencexmllocation" value="/com/software/persistence/persistence.xml"/> <property name="jpaproperties"> <map> <entry key="hibernate.id.new_generator_mappings" value="true"/> <entry key="hibernate.cache.use_second_level_cache" value="false"/> <entry key="hibernate.dialect" value="com.software.persistence.extendedoracle10gdialect"/> <entry key="hibernate.jdbc.batch_size" value="10"/> <entry key="hibernate.jdbc.batch_versioned_data" value="true"/> <entry key="hibernate.jdbc.batch.builder" value="com.software.persistence.oraclebatchbuilder"/> <entry key="hibernate.multitenancy" value="database"/> <entry key="hibernate.tenant_identifier_resolver" value="com.software.persistence.multitenantidentifierresolver"/> <entry key="hibernate.multi_tenant_connection_provider" value-ref="multitenantconnectionprovider" /> </map> </property>
mostly error seems because entity beans not getting scanned.
can share persistence.xml reference.
following can tried in order further debug (one of these step possible solve issue guess)
1 specify persistencexmllocation classpath this<property name="persistencexmllocation" value="classpath:/com/software/persistence/persistence.xml"/>
2 try persistenceunitpostprocessors scan beans <property name="persistenceunitpostprocessors" ref="some_implementation_bean_ref"/>
Comments
Post a Comment