Upgrading from beta 5 to beta 6 of the annotations I've started to get a very strange error when trying to use Map associations.
Given a property annotated like this:
Code:
@OneToMany(mappedBy = "category")
@MapKey(name = "translationLanguage")
@Where(clause = "tablename='CATEGORY' and status&1=1")
private Map<Language, CategoryTranslation> translations;
I get a very strange error about serialization.
Code:
Invocation of method 'getTranslationText' in class com.initech.system.model.Category
threw exception class org.hibernate.type.SerializationException : could not deserialize
then followed by this error
Code:
2005-11-16 14:22:02,826 ERROR [org.hibernate.LazyInitializationException] Host: 192.168.200.128 - illegal access to loading collection
org.hibernate.LazyInitializationException: illegal access to loading collection
at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:340)
at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:85)
at org.hibernate.collection.AbstractPersistentCollection.readElementByIndex(AbstractPersistentCollection.java:160)
at org.hibernate.collection.PersistentMap.get(PersistentMap.java:127)
at com.initech.system.model.Category.getTranslationText(Category.java:231)
This particular mapping works fine in Annotations 3.1 beta 5, but as soon as you use beta 6, the serialization error occurs.
I'll see if I can distill it down to a simple unit test as I can't paste the code in wholesale. I'd look at the differences in CVS between the releases, but sourceforge CVS is down at the moment.