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


while i query the database using a named query i run into a
StackOverflowError. I've put the whole stacktrace here:

The code:
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);
    return resultRecord;
  } catch (NoResultException nre) {
    return null;

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