[Hibernate-JIRA] Created: (HHH-7320) Fetch join multiple element collections
by Christian Beikov (JIRA)
Fetch join multiple element collections
---------------------------------------
Key: HHH-7320
URL: https://hibernate.onjira.com/browse/HHH-7320
Project: Hibernate ORM
Issue Type: Bug
Components: core, query-hql
Affects Versions: 4.1.3
Environment: All Hibernate Versions have this problem, it is unrelated to a database, it's kind of HQL specific.
Reporter: Christian Beikov
Attachments: TestMultipleFetchJoinElementCollections.zip
In the attachment you will see a sample maven project with a JUnit Test that will try to create a query that should actually work.
The problem is, that if the driving relation A has an element collection, that should be fetched,
but also a sub relation B has an element collection, that should also be fetched, the following error message will be printed:
org.hibernate.QueryException: query specified join fetching, but the owner of the fetched association was not present in the select list
I am not sure if that is supposed to work, but in my opinion it should!
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 8 months
[Hibernate-JIRA] Created: (HHH-5465) HQL left join fetch of an element collection following a left join fetch of a one-to-one relationship causes NullPointerException
by Andrew Tolopko (JIRA)
HQL left join fetch of an element collection following a left join fetch of a one-to-one relationship causes NullPointerException
---------------------------------------------------------------------------------------------------------------------------------
Key: HHH-5465
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5465
Project: Hibernate Core
Issue Type: Bug
Components: query-hql
Affects Versions: 3.5.4
Environment: Hibernate 3.5.4, Postgresql 8.4, Java 6
Reporter: Andrew Tolopko
Attachments: hibernate-left-fetch-join-element-collection.zip, log.txt
HQL queries of the form
"from EntityA a left join fetch a.entityB b left join fetch b.items"
fail with a NullPointerExeption when EntityA and EntityB have a one-to-one (@OneToOne) relationship and EntityB.items is an element collection (@ElementCollection, aka collection of values).
For comparison, the following HQL queries are all admissible (which intends to demonstrate that no particular clause of the the above HQL is incorrect):
"from EntityB b left join fetch b.items"
"from EntityA a left join fetch a.entityB"
"from EntityA a left join fetch a.entityB.items"
"from EntityA a left join fetch a.entityCs c left join fetch c.items" (where EntityA and EntityC have a one-to-many (@OneToMany) relationship, and EntityC.items is an element collection)
Test code is attached. The log output along with thrown exception is attached as log.txt.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 8 months
[Hibernate-JIRA] Created: (HHH-7312) JPA using schema based multi tenancy / resolveCurrentTenantIdentifier not called, cannot create entity manager
by Oriel Maute (JIRA)
JPA using schema based multi tenancy / resolveCurrentTenantIdentifier not called, cannot create entity manager
--------------------------------------------------------------------------------------------------------------
Key: HHH-7312
URL: https://hibernate.onjira.com/browse/HHH-7312
Project: Hibernate ORM
Issue Type: Bug
Components: core
Affects Versions: 4.1.2
Environment: Hibernate 4.1.2, using JPA
Reporter: Oriel Maute
Priority: Minor
Attachments: persistence.xml, SchemaBasedMultiTenancyTest.java, SchemaBasedMultiTenantConnectionProvider.java, SchemaBasedTenantResolver.java
I tried to use db schema based multi tenancy with hibernate jpa / entitymanager. I use the following properties in persistence.xml:
<property name="hibernate.multiTenancy" value="SCHEMA"/>
<property name="hibernate.tenant_identifier_resolver" value="com.xoricon.persistence.bo.multitenancy.test.SchemaBasedTenantResolver"/>
<property name="hibernate.multi_tenant_connection_provider" value="com.xoricon.persistence.bo.multitenancy.test.SchemaBasedMultiTenantConnectionProvider"/>
Both instances (SchemaBasedTenantResolver / SchemaBasedMultiTenantConnectionProvider) will be instantiated by hibernate.
When i call:
EntityManagerFactory lEntityManagerFactory= Persistence.createEntityManagerFactory("orm1");
EntityManager lManager = lEntityManagerFactory.createEntityManager();
I get:
System.out: SchemaBasedMultiTenantConnectionProvider.getAnyConnection()
System.out: SchemaBasedTenantResolver.<init>()
E
Time: 1,53
There was 1 error:
1) test1(com.xoricon.persistence.bo.multitenancy.test.SchemaBasedMultiTenancyTest)org.hibernate.HibernateException: SessionFactory configured for multi-tenancy, but no tenant identifier specified
at org.hibernate.internal.AbstractSessionImpl.<init>(AbstractSessionImpl.java:82)
at org.hibernate.internal.SessionImpl.<init>(SessionImpl.java:231)
at org.hibernate.internal.SessionFactoryImpl$SessionBuilderImpl.openSession(SessionFactoryImpl.java:1831)
at org.hibernate.ejb.EntityManagerImpl.getRawSession(EntityManagerImpl.java:121)
at org.hibernate.ejb.EntityManagerImpl.getSession(EntityManagerImpl.java:98)
at org.hibernate.ejb.AbstractEntityManagerImpl.setDefaultProperties(AbstractEntityManagerImpl.java:268)
at org.hibernate.ejb.AbstractEntityManagerImpl.postInit(AbstractEntityManagerImpl.java:180)
at org.hibernate.ejb.EntityManagerImpl.<init>(EntityManagerImpl.java:90)
at org.hibernate.ejb.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:178)
at org.hibernate.ejb.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:173)
at com.xoricon.persistence.bo.multitenancy.test.SchemaBasedMultiTenancyTest.test1(SchemaBasedMultiTenancyTest.java:40)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at com.xoricon.persistence.bo.multitenancy.test.SchemaBasedMultiTenancyTest.main(SchemaBasedMultiTenancyTest.java:51)
FAILURES!!!
Tests run: 1, Failures: 0, Errors: 1
In System.out "SchemaBasedTenantResolver.<init>()" shows, that my CurrentTenantIdentifierResolver has been instantiated. But Hiberante did not call method "public String resolveCurrentTenantIdentifier()".
I expect, that Hibernate uses the CurrentTenantIdentifierResolver to get the current tenant id.
In JPA i cannot set the tenant on the Session, because the exception above occures before Session has been created. I can access the Session only by EntityManager.getDelegate(). But as shown above, i cannot create an EntityManager instance.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 8 months
[Hibernate-JIRA] Created: (HHH-7306) SessionFactoryImpl#openSession() doesn't use CurrentTenantIdentifierResolver
by Stefan Schulze (JIRA)
SessionFactoryImpl#openSession() doesn't use CurrentTenantIdentifierResolver
----------------------------------------------------------------------------
Key: HHH-7306
URL: https://hibernate.onjira.com/browse/HHH-7306
Project: Hibernate ORM
Issue Type: Bug
Components: core
Affects Versions: 4.1.3, 4.1.2, 4.1.1, 4.1.0
Reporter: Stefan Schulze
Attachments: TestCase.zip
If I create a SessionFactory with a CurrentTenantIdentifierResolver, SessionFactoryImpl#openSession() doesn't use it. Instead it tries SessionFactory#withOptions().openSession() which causes a HibernateException:
org.hibernate.HibernateException: SessionFactory configured for multi-tenancy, but no tenant identifier specified
at org.hibernate.internal.AbstractSessionImpl.<init>(AbstractSessionImpl.java:82)
at org.hibernate.internal.SessionImpl.<init>(SessionImpl.java:234)
at org.hibernate.internal.SessionFactoryImpl$SessionBuilderImpl.openSession(SessionFactoryImpl.java:1843)
at org.hibernate.internal.SessionFactoryImpl.openSession(SessionFactoryImpl.java:1030)
[...]
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 8 months