[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [eclipselink-users] BasicCollection question
|
Martijn,
Are you mixing access types? If you class uses field access then it will not
process the annotations on the property and instead try to serialize the
responsibilities into a serialized mapping.
Cheers,
Guy
----- Original Message -----
From: "Martijn Morriën" <dj.escay@xxxxxxxxx>
To: <eclipselink-users@xxxxxxxxxxx>
Sent: Monday, December 01, 2008 9:51 AM
Subject: [eclipselink-users] BasicCollection question
The EclipseLink wiki page:
http://wiki.eclipse.org/Using_EclipseLink_JPA_Extensions_(ELUG)#How_to_Use_the_.40BasicCollection_Annotation
gives an example on how to use BasicCollection. However I could not
get it to work when I use the example:
@Entity
public class Employee implements Serializable{
...
@BasicCollection (
fetch=FetchType.EAGER,
valueColumn=@Column(name="DESCRIPTION")
)
@CollectionTable (
name="RESPONS",
primaryKeyJoinColumns=
{@PrimaryKeyJoinColumn(name="EMPLOYEE_ID",
referencedColumnName="EMP_ID")}
)
public Collection getResponsibilities() {
return responsibilities;
}
...
}
I get an exception:
Exception Description: The type [interface java.util.Collection] for
the attribute [responsibilities] on the entity class [class
testjpa.User] is not a valid type for a serialized mapping. The
attribute type must implement the Serializable interface.
It works when I add the annotation on the 'responsibilities' class
member as follows:
@BasicCollection (
fetch=FetchType.EAGER,
valueColumn=@Column(name="ROLE")
)
@CollectionTable (
name="USER_ROLE",
primaryKeyJoinColumns={
@PrimaryKeyJoinColumn(
name="USERID",
referencedColumnName="ID")
}
)
Collection responsibilities;
public Collection getResponsibilities() {
return responsibilities;
}
What did I do wrong? Or is the documentation using a construct I'm not
aware of...?
I also looked at the source code at
svn://dev.eclipse.org/svnroot/rt/org.eclipse.persistence and I could
not find 1 BasicCollection test or demo, are there any tests using
BasicCollection?
Thank you,
Martijn
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users