[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-5057) ScrollableResults does not fetch many-to-many collections
Jérôme Van Der Linden (JIRA)
noreply at atlassian.com
Wed Mar 31 15:13:31 EDT 2010
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-5057?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=36059#action_36059 ]
Jérôme Van Der Linden commented on HHH-5057:
--------------------------------------------
How do you explain that my OneToMany Collection is not null ?
> 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