[hibernate-issues] [Hibernate-JIRA] Resolved: (HHH-5057) ScrollableResults does not fetch many-to-many collections

Strong Liu (JIRA) noreply at atlassian.com
Wed Mar 31 11:53:38 EDT 2010


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-5057?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Strong Liu resolved HHH-5057.
-----------------------------

      Assignee: Strong Liu
    Resolution: Rejected

please read our document :)
[http://docs.jboss.org/hibernate/core/3.3/reference/en/html/batch.html#batch-statelesssession]
{quote}
Collections are ignored by a stateless session.
{quote}

> ScrollableResults does not fetch many-to-many collections
> ---------------------------------------------------------
>
>                 Key: HHH-5057
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5057
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.3.2
>            Reporter: Jérôme Van Der Linden
>            Assignee: Strong Liu
>            Priority: Blocker
>
> I have a many-to-many relation between two objects :
> {code:title=Project.java|borderStyle=solid}
> @Entity
> public class Project {
>   private List<Viperson> managers;
>   @ManyToMany(targetEntity = Viperson.class)
>   @JoinTable(name = "PRJMANAGER", joinColumns = @JoinColumn(name = "PROJECTID", nullable = false), inverseJoinColumns = @JoinColumn(name = "VIPID", nullable = false)) 
>   public List<Viperson> getManagers() {
>     return managers;
>   }
> }
> {code}
> {code:title=Viperson.java|borderStyle=solid}
> @Entity
> public class Viperson {
>   private List<Project> projects;
>   @ManyToMany(mappedBy = "managers", targetEntity = Project.class)
>   public List<Project> getProjects() {
>     return projects;
>   }
> }
> {code}
> And the following test (actually, it is a code from spring batch HibernateCursorItemReader I put in a testcase) : 
> {code}
> @Test
> public void testSelectAll() {
>   StatelessSession statelessSession = sessionFactory.openStatelessSession();
>   ScrollableResults cursor = statelessSession.createQuery("from Project").scroll();
>   Object[] data = null;
>   if (cursor.next()) {
>     data = cursor.get();
>   }
> }
> {code}
> data contains a {{Project}} but {{managers}} field is *null*, +even if I add eager fetching+. I have also a {{OneToMany}} in the {{Project}} class. This one is well loaded (i have a {{PersistentBag}}).
> Is there anything I miss ? I suspect a bug on that.

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