[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-1413) Multiple Bag fetches

Sergey Koshcheyev (JIRA) noreply at atlassian.com
Thu Mar 1 10:14:31 EST 2007


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1413?page=comments#action_26346 ] 

Sergey Koshcheyev commented on HHH-1413:
----------------------------------------

It seems that not only multiple bag fetches should be disallowed, but any multiple collection fetches which include a bag (with possibly some exceptions). For example, this currently fails for me on H3.2 from SVN (put this into ASTParserLoadingTest.java):

	public void testBagSetFetchFails() {
		Session s = openSession();
		s.beginTransaction();
		
		Human human = new Human();
		human.setFriends(new ArrayList());
		
		Human friend1 = new Human();
		Human friend2 = new Human();
		human.getFriends().add(friend1);
		human.getFriends().add(friend2);
		
		friend1.setNickNames(new TreeSet());
		friend1.getNickNames().add("nick1");
		friend1.getNickNames().add("nick2");
		
		friend2.setNickNames(new TreeSet());
		friend1.getNickNames().add("nick21");
		friend1.getNickNames().add("nick22");
		
		s.save(human);
		s.save(friend1);
		s.save(friend2);
		s.getTransaction().commit();
		s.close();
		
		s = openSession();
		human = (Human) s
			.createQuery( "from Human h join fetch h.friends f join fetch f.nickNames nof" )
			.uniqueResult();
		assertTrue(Hibernate.isInitialized(human.getFriends()));
		assertEquals(2, human.getFriends().size());
		s.getTransaction().commit();
		s.close();
	}


> Multiple Bag fetches
> --------------------
>
>          Key: HHH-1413
>          URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1413
>      Project: Hibernate3
>         Type: Improvement

>   Components: query-hql, query-criteria
>     Reporter: Steve Ebersole
>     Assignee: Steve Ebersole

>
>
> two options here:
> 1) disallow
> 2) fall back to subselect fetching (or another more appropriate fetching strategy) for all but one of the bags.

-- 
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.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira




More information about the hibernate-issues mailing list