Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] StackOverflowError while query

Hi Christian,

  What are your cache settings?

The most common reason people see this kind of errors is that they (incorrectly) turn off the cache and then try to run a query that has a cycle with no LAZY relationships involved.

-Tom

Christian (VuuRWerK) Seifert wrote:
Hi,

while i query the database using a named query i run into a
StackOverflowError. I've put the whole stacktrace here:
http://vuurwerk.pastebin.com/Dbrsx9aV

The code:
<snip>
protected final T findFirstByNamedQuery(final EntityManager em,
    final String namedQuery, QueryParameter<?>... queryParameters) {
  Query qry = em.createNamedQuery(namedQuery);

  for (QueryParameter<?> queryParameter : queryParameters)
    qry.setParameter(queryParameter.name, queryParameter.value);

  try {
    Object result = qry.getSingleResult();
    T resultRecord = ((result != null &&
_classType.isInstance(result)) ? _classType.cast(result) : null);
    resultRecord.setModel(this);
    return resultRecord;
  } catch (NoResultException nre) {
    return null;
  }
}
</snap>

The JPQL of the named query: SELECT lutp FROM LookupProfile lutp WHERE
lutp.name = :name

The first weird thing is that the same code works in another part of
my application. I just use the same method where i need to do the same
but in the first part of my application the query works correctly and
at the other part where I need the same result just for other
operations i get this StackOverflowError.

Another weird thing: The error occurs only if the query will give
definitely a result, if i use a name where I know there will be no
result the error does not happen.

I've checked if there is anything odd to the other part, but there
seems to be no difference :(
I have no idea why this happen :(

If someone need more information please ask me about it.

-- Christian
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


Back to the top