private void doSetFetchPlan(int fetchCount, JDBCFetchPlan fetch) { fetch.setFetchBatchSize(fetchCount); fetch.setResultSetType(ResultSetType.SCROLL_INSENSITIVE); fetch.setFetchDirection(FetchDirection.FORWARD); fetch.setLRSSizeAlgorithm(LRSSizeAlgorithm.UNKNOWN); } }
@Override public Object beginTransaction(final EntityManager entityManager, final TransactionDefinition definition) throws PersistenceException, SQLException, TransactionException { OpenJPAEntityManager openJpaEntityManager = getOpenJPAEntityManager(entityManager); if (definition.getIsolationLevel() != TransactionDefinition.ISOLATION_DEFAULT) { // Pass custom isolation level on to OpenJPA's JDBCFetchPlan configuration FetchPlan fetchPlan = openJpaEntityManager.getFetchPlan(); if (fetchPlan instanceof JDBCFetchPlan) { IsolationLevel isolation = IsolationLevel.fromConnectionConstant(definition.getIsolationLevel()); ((JDBCFetchPlan) fetchPlan).setIsolation(isolation); } } entityManager.getTransaction().begin(); if (!definition.isReadOnly()) { // Like with EclipseLink, make sure to start the logic transaction early so that other // participants using the connection (such as JdbcTemplate) run in a transaction. openJpaEntityManager.beginStore(); } // Custom implementation for OpenJPA savepoint handling return new OpenJpaTransactionData(openJpaEntityManager); }
OpenJPAQuery kq = OpenJPAPersistence.cast(q); JDBCFetchPlan fetch = (JDBCFetchPlan) kq.getFetchPlan(); fetch.setEagerFetchMode(FetchMode.JOIN);
@Override public Object beginTransaction(EntityManager entityManager, TransactionDefinition definition) throws PersistenceException, SQLException, TransactionException { OpenJPAEntityManager openJpaEntityManager = getOpenJPAEntityManager(entityManager); if (definition.getIsolationLevel() != TransactionDefinition.ISOLATION_DEFAULT) { // Pass custom isolation level on to OpenJPA's JDBCFetchPlan configuration FetchPlan fetchPlan = openJpaEntityManager.getFetchPlan(); if (fetchPlan instanceof JDBCFetchPlan) { IsolationLevel isolation = IsolationLevel.fromConnectionConstant(definition.getIsolationLevel()); ((JDBCFetchPlan) fetchPlan).setIsolation(isolation); } } entityManager.getTransaction().begin(); if (!definition.isReadOnly()) { // Like with EclipseLink, make sure to start the logic transaction early so that other // participants using the connection (such as JdbcTemplate) run in a transaction. openJpaEntityManager.beginStore(); } // Custom implementation for OpenJPA savepoint handling return new OpenJpaTransactionData(openJpaEntityManager); }
fetch.setEagerFetchMode(FetchMode.JOIN);
fetch.setFetchBatchSize(20); fetch.setResultSetType(ResultSetType.SCROLL_INSENSITIVE); fetch.setFetchDirection(FetchDirection.FORWARD); fetch.setLRSSizeAlgorithm(LRSSizeAlgorithm.LAST); List<?> resultList = q.getResultList(); List<Object[]> objectArrList = (List<Object[]>) resultList;
fetch.setFetchBatchSize(20); fetch.setResultSetType(ResultSetType.SCROLL_INSENSITIVE); fetch.setFetchDirection(FetchDirection.FORWARD); fetch.setLRSSizeAlgorithm(LRSSizeAlgorithm.LAST); List<?> resultList = q.getResultList(); List<Object[]> objectArrList = (List<Object[]>) resultList;
fetch.setFetchBatchSize(20); fetch.setResultSetType(ResultSetType.SCROLL_INSENSITIVE); fetch.setFetchDirection(FetchDirection.FORWARD); fetch.setLRSSizeAlgorithm(LRSSizeAlgorithm.LAST); List<?> resultList = q.getResultList(); List<Object[]> objectArrList = (List<Object[]>) resultList;
fetch.setFetchBatchSize(20); fetch.setResultSetType(ResultSetType.SCROLL_INSENSITIVE); fetch.setFetchDirection(FetchDirection.FORWARD); fetch.setLRSSizeAlgorithm(LRSSizeAlgorithm.LAST); List<?> resultList = q.getResultList(); List<Object[]> objectArrList = (List<Object[]>) resultList;
fetch.setFetchBatchSize(20); fetch.setResultSetType(ResultSetType.SCROLL_INSENSITIVE); fetch.setFetchDirection(FetchDirection.FORWARD); fetch.setLRSSizeAlgorithm(LRSSizeAlgorithm.LAST); List<?> resultList = q.getResultList(); List<Object[]> objectArrList = (List<Object[]>) resultList;
fetch.setFetchBatchSize(20); fetch.setResultSetType(ResultSetType.SCROLL_INSENSITIVE); fetch.setFetchDirection(FetchDirection.FORWARD); fetch.setLRSSizeAlgorithm(LRSSizeAlgorithm.LAST); List<?> resultList = q.getResultList(); List<Object[]> objectArrList = (List<Object[]>) resultList;
fetch.setFetchBatchSize(20); fetch.setResultSetType(ResultSetType.SCROLL_INSENSITIVE); fetch.setFetchDirection(FetchDirection.FORWARD); fetch.setLRSSizeAlgorithm(LRSSizeAlgorithm.LAST); List<?> resultList = q.getResultList(); List<Object[]> objectArrList = (List<Object[]>) resultList;
fetch.setFetchBatchSize(20); fetch.setResultSetType(ResultSetType.SCROLL_INSENSITIVE); fetch.setFetchDirection(FetchDirection.FORWARD); fetch.setLRSSizeAlgorithm(LRSSizeAlgorithm.LAST); List<?> resultList = q.getResultList(); List<Object[]> objectArrList = (List<Object[]>) resultList;