PersistentMap.keySet seems to produce a set containing values rather than keys.
Description
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.
Environment
Also Hibernate EntityManager 3.4.0 if that is relevant.
Activity
no response
Unfortunately, I've changed my code so it doesn't try to do this any more. Using a persistent Map was overkill for my current purposes anyway; I was just using it to ensure each actor was in the list only once. I'll see if I can get a test case running and test it out with the latest Hibernate. It may take me a while though as I am pressed for time at the moment. (Though aren't we all)
Is this still an issue in 3.5.3?
oops, formatting screwy. A lot of the stuff in the description is supposed to be code fragments. Here's the improved version with appropriate markup:
I have a persistent Map defined as follows:
where
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:
But the ids set seems to contain the Actors rather than the Actor IDs.
(p.s., the JIRA wiki code formatting is not very good )