[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2112) ClassCastException in StatefulPersistenceContext.getCachedDatabaseSnapshot(...)
Tiago Silveira (JIRA)
noreply at atlassian.com
Thu Feb 1 12:03:41 EST 2007
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2112?page=comments#action_25966 ]
Tiago Silveira commented on HHH-2112:
-------------------------------------
I still have the problem with Map.remove() using 3.2.2.GA.
java.lang.ClassCastException: org.hibernate.util.MarkerObject
at org.tinymarbles.model.PType.remove(PType.java:172)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:147)
The line in question is:
> PAttribute attribute = this.getAttributes().remove(attName);
the getter returns Map<String, PAttribute> declared as follows:
> @OneToMany(mappedBy = "type", fetch = FetchType.LAZY)
> @MapKey(name = "name")
> @Cascade(value = {CascadeType.REMOVE, CascadeType.DELETE_ORPHAN, CascadeType.SAVE_UPDATE})
> @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
> private Map<String, PAttribute> attributes = new HashMap<String, PAttribute>();
Yes, I'm using field mapping. :-)
The workaround with Map.containsKey() works for me.
> ClassCastException in StatefulPersistenceContext.getCachedDatabaseSnapshot(...)
> -------------------------------------------------------------------------------
>
> Key: HHH-2112
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2112
> Project: Hibernate3
> Type: Bug
> Components: core
> Versions: 3.2.0.cr4
> Reporter: Aleksei Valikov
> Assignee: Steve Ebersole
> Fix For: 3.2.2
>
>
> StatefulPersistenceContext.getCachedDatabaseSnapshot(EntityKey key) causes ClassCastException when NO_ROW was put for the certain entity key.
> Please see the discussion here:
> http://forum.hibernate.org/viewtopic.php?t=959868&highlight=getcacheddatabasesnapshot
> In these situations, this method should probably return null. It is very likely since other calling methods check for the returned value to be null .
--
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.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list