-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Hibernate 4 Multi-tenancy Issue - No Entity Persisters Found
PostPosted: Mon Jun 29, 2015 1:14 am 
Newbie

Joined: Fri Jun 30, 2006 12:11 am
Posts: 7
Location: Pune
Hello,

I have been trying to integrate hibernate 4 multi-tenancy support in our application but I get the below exception on executing an hql query

Code:
java.lang.ArrayIndexOutOfBoundsException: 0
    at org.hibernate.jpa.spi.AbstractEntityManagerImpl.resultClassChecking(AbstractEntityManagerImpl.java:362)
    at org.hibernate.jpa.spi.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:344)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:344)
    at com.sun.proxy.$Proxy288.createQuery(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:291)
    at com.sun.proxy.$Proxy43.createQuery(Unknown Source)

The hql query is -
Code:
List<Field> fields = entityManager.createQuery("from " + Employee.class.getName() +
                    " where " + getQueryForInClause("id", ids), Employee.class).getResultList();

On debugging hibernate source, I realize that this is because hibernate's SessionFactory instance does not have any entityPersister instances due to which the hql query does have any translator's.

Is it because the Entity beans are not getting scanned? If so what could be the cause?

The entityFactory spring is declared as below

Code:
<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>

Thanks,
Amit.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.