У меня есть таблица базы данных с 5 строками.
При первом выборе всех я получаю StackOverflowError
em.createQuery("SELECT e FROM " + clazz.getSimpleName() + " e");
Как бы то ни было, если я сделаю один выбор для каждого изстроки
em.find(clazz, 1);
em.find(clazz, 2);
em.find(clazz, 3);
em.find(clazz, 4);
em.find(clazz, 5);
Тогда выделение все работает отлично.Я предполагаю, что это как-то связано с тем, что записи еще не находятся в кэше?
Полная трассировка стека слишком длинна, вот верхняя часть
java.lang.StackOverflowError в org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass (DefaultClassLoader.java:107) в java.lang.ClassLoader.loadClass (неизвестный источник) в java.lang.ClassLoader.loadClassInternal (неизвестный источник) в com.mysql.jdbc.Util.handleNewInstance (Util.java:427) в com.mysql.jdbc.PreparedStatement.getInstance (PreparedStatement.java:872) в com.mysql.jdbc.ConnectionImpl.clientPrepareStatement (ConnectionImpl.java:1498) в com.mysq..prepareStatement (ConnectionImpl.java:4270) в com.mysql.jdbc.ConnectionImpl.prepareStatement (ConnectionImpl.java:4169) в org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.prepareStatement (DatabaseAccessor.java: или.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.prepareStatement (DatabaseAccessor.java:1350) в org.eclipse.persistence.internal.databaseaccess.DatabaseCall.prepareStatement (DatabaseCall.java:652) в org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall (DatabaseAccessor.java:576) в org.eclipse.persistence.internal.databaseaccess.DexecuteCall (DatabaseAccessor.java:526) в org.eclipse.persistence.sessions.server.ServerSession.executeCall (ServerSession.java:529) в org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall (Davasource)в org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall (DatasourceCallQueryMechanism.java:192) в org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.selectOneRasep.jatSync_jat_WeQW ().queries.ExpressionQueryMechanism.selectOneRowFromTable (ExpressionQueryMechanism.java:2582) в org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectOneRow (ExpressionQueryMechanis)m.java:2553) at org.eclipse.persistence.queries.ReadObjectQuery.executeObjectLevelReadQuery (ReadObjectQuery.java:439) по адресу org.eclipse.persistence.queries.ObjectLevelReadQuery.execu..queries.DatabaseQuery.execute (DatabaseQuery.java:740) на org.eclipse.persistence.queries.ObjectLevelReadQuery.execute (ObjectLevelReadQuery.java:1036) на org.eclipse.persistence.queries.ReadObjectQueryex) в org.eclipse.persistence.internal.sessions.AbstractSession.internalExecuteQuery (AbstractSession.java:2392) в org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery (AbstractSession.java:1291) в org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery (AbstractSession.java:1273) в org.eclipse.persistence.internal.indirection.NoIndirectionPolicy.valueFromQuery (NoIndirectionPolicy.java:309) в org.eclipse.persistance.maueIngnReferenceMapping.java:1850) в org.eclipse.persistence.mappings.OneToOneMapping.valueFromRowInternal (OneToOneMapping.java:1623) в org.eclipse.persistence.mappings.ForeignReferenceMapping.valueFromava.jp.RejRej.jpg.mappings.DatabaseMapping.readFromRowIntoObject (DatabaseMapping.java:1283) в org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildAttributesIntoObject (ObjectBuilder.java:342) в org.eclipse.BejectObBuilderO.java: 717)в org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject (ObjectBuilder.java:504) в org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject (ObjectBuilder.java:454) в org.ecquipse.ObjectLevelReadQuery.buildObject (ObjectLevelReadQuery.java:723) в org.eclipse.persistence.queries.ReadObjectQuery.executeObjectLevelReadQuery (ReadObjectQuery.java:4exj.WeQuery.WeuQuery).org.eclipse.persistence.queries.DatabaseQuery.execute (DatabaseQuery.java:740) в org.eclipse.persistence.queries.ObjectLevelReadQuery.execute (ObjectLevelReadQuery.java:1036) в org.eclipse.persery.bject (query)ReadObjectQuery.java:407) в org.eclipse.persistence.internal.sessions.AbstractSession.internalExecuteQuery (AbstractSession.java:2392) в org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery (AbstractSession.java:12).eclipse.persistence.internal.sessions.AbstractSession.executeQuery (AbstractSession.java:1273) в org.eclipse.persistence.internal.indirection.NoIndirectionPolicy.valueFromQuery (NoIndirectionPolicy.java:309) в org.eclipseMountingFigningFireForeignReferenceMapping.java:1850) в org.eclipse.persistence.mappings.OneToOneMapping.valueFromRowInternal (OneToOneMapping.java:1623) в org.eclipse.persistence.mappings.ForeignReferenceMapping.valueFromPoint.a.mappings.DatabaseMapping.readFromRowIntoObject (DatabaseMapping.java:1283) в org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildAttributesIntoObject (ObjectBuilder.java:342) в org.eclipse.BejectObBuilderO.java: 717) в org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject (ObjectBuilder.java:504) в org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject (ObjectBuilder.java:454) по адресу org.eclipse.persistence.queries.ObjectLevelReadQuery.buildObject (ObjectLevelReadQuery.java:723) по адресу org.eclipse.persistence.queries.ReadObjectQuery.executeObjectl.Reef.Exe.persistence.queries.ObjectLevelReadQuery.executeDatabaseQuery (ObjectLevelReadQuery.java:1076) в org.eclipse.persistence.queries.DatabaseQuery.execute (DatabaseQuery.java:740) в org.eclipse.persistence.queryexeadQueryUject: 1036) в org.eclipse.persistence.queries.ReadObjectQuery.execute (ReadObjectQuery.java:407) в org.eclipse.persistence.internal.sessions.AbstractSession.internalExecuteQuery (AbstractSession.java:2392) в org.ecip.internal.sessions.AbstractSession.executeQuery (AbstractSession.java:1291) в org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery (AbstractSession.java:1273) в org.eclipse.persistence.internal.indirection.NoIndireueFicyNoIndirectionPolicy.java:309) в org.eclipse.persistence.mappings.ForeignReferenceMapping.valueFromRowInternal (ForeignReferenceMapping.java:1850) в org.eclipse.persistence.mappings.OneToOneMapping.valueFromRowInne.perjj.jip.Oj.Oj.OneO.mappings.: 342) в org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject (ObjectBuilder.java:717) в org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject (ObjectBuilder.java:504)в org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject (ObjectBuilder.java:454)
в org.eclipse.persistence.queries.ObjectLevelReadQuery.buildObject (ObjectLevelReadQuery.java:723)
в org.eclipse.persistence.queries.ReadObjectQuery.executeObjectLevelReadQuery (ReadObjectQuery.java:448)
в org.eclipse.persistence.queries.ObjectLevelReadQuery.executeDatabaseQuery (ObjectLevelReadQuery.java:1076)
в org.eclipse.persistence.queries.DatabaseQuery.execute (DatabaseQuery.java:740)
в org.eclipse.persistence.queries.ObjectLevelReadQuery.execute (ObjectLevelReadQuery.java:1036)
в org.eclipse.persistence.queries.ReadObjectQuery.execute (ReadObjectQuery.java:407)
в org.eclipse.persistence.internal.sessions.AbstractSession.internalExecuteQuery (AbstractSession.java:2392)
в org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery (AbstractSession.java:1291)
в org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery (AbstractSession.java:1273)
в org.eclipse.persistence.internal.indirection.NoIndirectionPolicy.valueFromQuery (NoIndirectionPolicy.java:309)
в org.eclipse.persistence.mappings.ForeignReferenceMapping.valueFromRowInternal (ForeignReferenceMapping.java:1850)
в org.eclipse.persistence.mappings.OneToOneMapping.valueFromRowInternal (OneToOneMapping.java:1623)
в org.eclipse.persistence.mappings.ForeignReferenceMapping.valueFromRow (ForeignReferenceMapping.java:1739)
в org.eclipse.persistence.mappings.DatabaseMapping.readFromRowIntoObject (DatabaseMapping.java:1283)
в org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildAttributesIntoObject (ObjectBuilder.java:342)
в org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject (ObjectBuilder.java:717)
в org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject (ObjectBuilder.java:504)
в org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject (ObjectBuilder.java:454)
в org.eclipse.persistence.queries.ObjectLevelReadQuery.buildObject (ObjectLevelReadQuery.java:723)
в org.eclipse.persistence.queries.ReadObjectQuery.executeObjectLevelReadQuery (ReadObjectQuery.java:448)
в org.eclipse.persistence.queries.ObjectLevelReadQuery.executeDatabaseQuery (ObjectLevelReadQuery.java:1076)
в org.eclipse.persistence.queries.DatabaseQuery.execute (DatabaseQuery.java:740)