[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.rt.eclipselink] Re: How to use @BasicMap for a HashMap whose key values are entities
|
- From: kimppal@xxxxxxxxx ( Kim L)
- Date: Tue, 21 Apr 2009 20:35:42 +0000 (UTC)
- Newsgroups: eclipse.rt.eclipselink
- Organization: Eclipse
- User-agent: NewsPortal/0.36 (http://florian-amrhein.de/newsportal)
I tried what you suggested, but got this error message
Internal Exception: Exception [EclipseLink-7155] (Eclipse Persistence
Services - 2.0.0.r3652-M1):
org.eclipse.persistence.exceptions.ValidationException
Exception Description: The type [interface java.util.Map] for the
attribute [myMap] on the entity class [class MyAClass] is not a valid type
for a serialized mapping. The attribute type must implement the
Serializable interface.
The wiki page about error references was a bit cryptic
ECLIPSELINK-07155: The type [{1}] for the attribute [{0}] on the entity
class [{2}] is not a valid type for a serialized mapping. The attribute
type must implement the Serializable interface.
Cause: An annotation @AttributeOverride columns was not specified on a
mapping mapping from entity class ClassName.
Action: Specify this annotation.
Here what I have (yes, the key in the map is of same type as the class
itself):
@Entity
class MyAClass {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
protected Long id;
@CollectionTable(name = "MYACLASS_DEPENDENCIES", joinColumns =
@JoinColumn(name = "MYACLASS"))
@Column(name = "REQ_LEVEL")
@MapKeyJoinColumn(name = "MYACLASS", referencedColumnName = "ID")
private Map<MyAClass, Integer> myMap = new HashMap<MyAClass ,
Integer>();
}