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 Michael,

EclipseLink will replace the collection when it is building objects, so it will result in multiple collections being unnecessarily created.  You might want to lazily initialize the collection in a get method instead to avoid the extra overhead of creating and then garbage collecting.

It is not wrong to initialize the collection though, so please be sure to file a bug.


On 06/05/2010 4:48 AM, Michael Simons wrote:
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 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<>();

In this case, the error-condition might be avoided by a pattern like this:

List<Event> newEvents = new ArrayList<>();

It also might be worth a try to use the EclipseLink javaagent for
dynamic weaving (ELUG #Using_Weaving

Or if this all does not help, try to temporarily switch off the shared

<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.


    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
Sent from the EclipseLink - Users mailing list archive
<> at


eclipselink-users mailing list

eclipselink-users mailing list

Back to the top