[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5398?page=c...
]
rufus hamade commented on HHH-5398:
-----------------------------------
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:
{noformat}
@Entity
public class Task {
[snip]
@OneToMany(mappedBy="task")
@MapKey(name="actor")
private Map<Long, TaskCC> ccs = new HashMap<Long, TaskCC>();
}
{noformat}
where
{noformat}
@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;
{noformat}
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:
{noformat}
ids = new HashSet<Long>(bug.getCcs().keySet());
{noformat}
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:-( )
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira