Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] ClassCastException when exeuting query

Hello Frank,

The events list is encapsulated in Trip that implements List<TripEvent>. So I'm sure there's no
such code like you mentioned.
The only place that directly sets the Trip.events list is the declaration:
	/** The sequence of events */
	@OneToMany(mappedBy="parentTrip", cascade=CascadeType.ALL, fetch=FetchType.LAZY)
	private List<TripEvent>		events = new ArrayList<TripEvent> (31);

Might this be the reason? Shouldn't we initialize collections?

- Michael

Frank Schwarz schrieb:
> From looking at the stacktrace, there might be some code in your
> application like:
> 
> List<Event> newEvents = new ArrayList<>();
> newEvents.add(...);
> aTrip.setEvents(newEvents);
> 
> In this case, the error-condition might be avoided by a pattern like this:
> 
> List<Event> newEvents = new ArrayList<>();
> newEvents.add(...);
> aTrip.getEvents().clear();
> aTrip.getEvents().addAll(newEvents);
> 
> It also might be worth a try to use the EclipseLink javaagent for
> dynamic weaving (ELUG #Using_Weaving
> <http://wiki.eclipse.org/Introduction_to_EclipseLink_Application_Development_%28ELUG%29#Using_Weaving>).
> 
> Or if this all does not help, try to temporarily switch off the shared
> cache.
> 
> <property name="eclipselink.cache.shared.default" value="false" />
> 
> Please note that this is all pure speculation and might not be related
> to the actual bug.
> 
> HTH,
> Frank
> 
>     Michael Simons wrote:
>     Hello James, is there a work-around? Do You know what causes the bug
>     "to bite"? Is it the combination of hints, we're using? - Michael
> 
> 
> View this message in context: Re: ClassCastException when exeuting query
> <http://old.nabble.com/ClassCastException-when-exeuting-query-tp28446622p28469947.html>
> Sent from the EclipseLink - Users mailing list archive
> <http://old.nabble.com/EclipseLink---Users-f26658.html> at Nabble.com.
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> eclipselink-users mailing list
> eclipselink-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/eclipselink-users




Back to the top