[hibernate-issues] [Hibernate-JIRA] Created: (HHH-5398) PersistentMap.keySet seems to produce a set containing values rather than keys.

rufus hamade (JIRA) noreply at atlassian.com
Wed Jul 21 09:48:35 EDT 2010


PersistentMap.keySet seems to produce a set containing values rather than keys.
-------------------------------------------------------------------------------

                 Key: HHH-5398
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5398
             Project: Hibernate Core
          Issue Type: Bug
          Components: core
    Affects Versions: 3.3.0.SP1
         Environment: Also Hibernate EntityManager 3.4.0 if that is relevant.
            Reporter: rufus hamade


I have a persistent Map defined as follows:

@Entity
public class Task  {
 [snip]
	@OneToMany(mappedBy="task")
	@MapKey(name="actor")
	private Map<Long, TaskCC> ccs = new HashMap<Long, TaskCC>();
}

where 

@Entity
public class TaskCC {
	@Id
	@GeneratedValue
	private Long id;

	@ManyToOne(fetch=FetchType.LAZY)
	private Task task;
	
	@ManyToOne(fetch=FetchType.LAZY)
	@AccessType("field")
	private Actor actor;
}

and actor is an independent entity (i.e., no associations to Task or TaskCC) with a Long id field.

We have some code that does something like:
        	ids = new HashSet<Long>(bug.getCcs().keySet());

But the ids set seems to contain the Actors rather than the Actor IDs.

Let me know if the above is not sufficient and/or you want me to create a simplified test case for this.

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