Hi,
Can you please explain the casting rule on this example? Why does it cause
exception?
Thanks
The userProfileDO is the object extracted from database through hibernate
ArrayList<Contact> tmpContactList = (ArrayList<Contact>)
userProfileDO.getContacts();
//warning message: List is a raw type. References to generic type List<E>
should be parameterized
public List getContacts()
{
return this.contacts;
}
The above ArrayList<Contact> casting caused exception
com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public
abstract com.project.frontpage.client.serialize.UserProfile
com.rentorama2.frontpage.client.rpc.Access.getUserProfile(long) throws
com.project.frontpage.client.serialize.LoginServiceException' threw an
unexpected exception: java.lang.ClassCastException:
org.hibernate.collection.PersistentList cannot be cast to java.util.ArrayList
......
Caused by: java.lang.ClassCastException:
org.hibernate.collection.PersistentList cannot be cast to java.util.ArrayList
at
com.project.frontpage.server.dao.UserProfileDAO.getUserProfile(UserProfileDAO.java:250)
at
com.project.frontpage.server.impl.AccessImpl.getUserProfile(AccessImpl.java:655)
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.