/** * INTERNAL: * Return temporary map of batched objects. */ public Map<Object, Object> getBatchObjects() { return (Map<Object, Object>)getProperty(BATCH_FETCH_PROPERTY); }
/** * INTERNAL: * Return temporary map of batched objects. */ public Map<Object, Object> getBatchObjects() { return (Map<Object, Object>)getProperty(BATCH_FETCH_PROPERTY); }
/** * INTERNAL: * TopLink_sessionName_domainClass. Cached in properties */ public String getDomainClassNounName(String sessionName) { if (getProperty("DMSDomainClassNounName") == null) { StringBuilder buffer = new StringBuilder("EclipseLink"); if (sessionName != null) { buffer.append(sessionName); } if (getReferenceClassName() != null) { buffer.append("_"); buffer.append(getReferenceClassName()); } setProperty("DMSDomainClassNounName", buffer.toString()); } return (String)getProperty("DMSDomainClassNounName"); }
/** * INTERNAL: * TopLink_sessionName_domainClass. Cached in properties */ public String getDomainClassNounName(String sessionName) { if (getProperty("DMSDomainClassNounName") == null) { StringBuilder buffer = new StringBuilder("EclipseLink"); if (sessionName != null) { buffer.append(sessionName); } if (getReferenceClassName() != null) { buffer.append("_"); buffer.append(getReferenceClassName()); } setProperty("DMSDomainClassNounName", buffer.toString()); } return (String)getProperty("DMSDomainClassNounName"); }
/** * INTERNAL: * TopLink_sessionName_domainClass_queryClass_queryName (if exist). Cached in properties */ public String getQueryNounName(String sessionName) { if (getProperty("DMSQueryNounName") == null) { StringBuilder buffer = new StringBuilder(getDomainClassNounName(sessionName)); buffer.append("_"); buffer.append(getClass().getSimpleName()); if (getName() != null) { buffer.append("_"); buffer.append(getName()); } setProperty("DMSQueryNounName", buffer.toString()); } return (String)getProperty("DMSQueryNounName"); }
/** * INTERNAL: * TopLink_sessionName_domainClass_queryClass_queryName (if exist). Cached in properties */ public String getQueryNounName(String sessionName) { if (getProperty("DMSQueryNounName") == null) { StringBuilder buffer = new StringBuilder(getDomainClassNounName(sessionName)); buffer.append("_"); buffer.append(getClass().getSimpleName()); if (getName() != null) { buffer.append("_"); buffer.append(getName()); } setProperty("DMSQueryNounName", buffer.toString()); } return (String)getProperty("DMSQueryNounName"); }
static DatabaseQuery apply(String hintName, boolean shouldUseDefault, Object hintValue, DatabaseQuery query, ClassLoader loader, AbstractSession activeSession) { Hint hint = (Hint)mainMap.get(hintName); if (hint == null) { // unknown hint name - silently ignored. return query; } Map<String, Object> existingHints = (Map<String, Object>)query.getProperty(QUERY_HINT_PROPERTY); if (existingHints == null){ existingHints = new HashMap<String, Object>(); query.setProperty(QUERY_HINT_PROPERTY, existingHints); } existingHints.put(hintName, hintValue); return hint.apply(hintValue, shouldUseDefault, query, loader, activeSession); }
/** * INTERNAL: * TopLink_sessionName_domainClass. Cached in properties */ public String getDomainClassNounName(String sessionName) { if (getProperty("DMSDomainClassNounName") == null) { StringBuffer buffer = new StringBuffer("EclipseLink"); if (sessionName != null) { buffer.append(sessionName); } if (getReferenceClassName() != null) { buffer.append("_"); buffer.append(getReferenceClassName()); } setProperty("DMSDomainClassNounName", buffer.toString()); } return (String)getProperty("DMSDomainClassNounName"); }
/** * INTERNAL: * TopLink_sessionName_domainClass_queryClass_queryName (if exist). Cached in properties */ public String getQueryNounName(String sessionName) { if (getProperty("DMSQueryNounName") == null) { StringBuffer buffer = new StringBuffer(getDomainClassNounName(sessionName)); buffer.append("_"); buffer.append(getClass().getSimpleName()); if (getName() != null) { buffer.append("_"); buffer.append(getName()); } setProperty("DMSQueryNounName", buffer.toString()); } return (String)getProperty("DMSQueryNounName"); }
/** * @see Query#getHints() * @since Java Persistence 2.0 */ public Map<String, Object> getHints() { entityManager.verifyOpenWithSetRollbackOnly(); return (Map<String, Object>) getDatabaseQueryInternal().getProperty(QueryHintsHandler.QUERY_HINT_PROPERTY); }
/** * INTERNAL: * Process the JPA named queries into EclipseLink Session queries. */ public void processJPAQueries() { List queries = getJPAQueries(); for (Iterator iterator = queries.iterator(); iterator.hasNext();) { DatabaseQuery jpaQuery = (DatabaseQuery)iterator.next(); jpaQuery.checkPrepare(this, null); DatabaseQuery databaseQuery = (DatabaseQuery)jpaQuery.getProperty("databasequery"); addQuery(databaseQuery.getName(), databaseQuery); } queries.clear(); }
/** * INTERNAL: * The hashtable of batched objects resides in one of two places. * In the normal case it is stored in a query property. * When a UnitOfWork is in transaction, it executes the batch query * on the UnitOfWork and stores the clones on the UnitOfWork. */ protected Hashtable getBatchReadObjects(DatabaseQuery query, AbstractSession session) { if (session.isUnitOfWork()) { UnitOfWorkImpl unitOfWork = (UnitOfWorkImpl)session; return (Hashtable)unitOfWork.getBatchReadObjects().get(query); } else { return (Hashtable)query.getProperty("batched objects"); } }
/** * INTERNAL: * TopLink_sessionName_domainClass_queryClass_queryName (if exist)_operationName (if exist). Cached in properties */ public String getSensorName(String operationName, String sessionName) { if (operationName == null) { return getQueryNounName(sessionName); } Hashtable sensorNames = (Hashtable)getProperty("DMSSensorNames"); if (sensorNames == null) { sensorNames = new Hashtable(); setProperty("DMSSensorNames", sensorNames); } Object sensorName = sensorNames.get(operationName); if (sensorName == null) { StringBuffer buffer = new StringBuffer(getQueryNounName(sessionName)); buffer.append("_"); buffer.append(operationName); sensorName = buffer.toString(); sensorNames.put(operationName, sensorName); } return (String)sensorName; }
/** * INTERNAL: * TopLink_sessionName_domainClass_queryClass_queryName (if exist)_operationName (if exist). Cached in properties */ public String getSensorName(String operationName, String sessionName) { if (operationName == null) { return getQueryNounName(sessionName); } Hashtable sensorNames = (Hashtable)getProperty("DMSSensorNames"); if (sensorNames == null) { sensorNames = new Hashtable(); setProperty("DMSSensorNames", sensorNames); } Object sensorName = sensorNames.get(operationName); if (sensorName == null) { StringBuilder buffer = new StringBuilder(getQueryNounName(sessionName)); buffer.append("_"); buffer.append(operationName); sensorName = buffer.toString(); sensorNames.put(operationName, sensorName); } return (String)sensorName; }
/** * INTERNAL: * TopLink_sessionName_domainClass_queryClass_queryName (if exist)_operationName (if exist). Cached in properties */ public String getSensorName(String operationName, String sessionName) { if (operationName == null) { return getQueryNounName(sessionName); } Hashtable sensorNames = (Hashtable)getProperty("DMSSensorNames"); if (sensorNames == null) { sensorNames = new Hashtable(); setProperty("DMSSensorNames", sensorNames); } Object sensorName = sensorNames.get(operationName); if (sensorName == null) { StringBuilder buffer = new StringBuilder(getQueryNounName(sessionName)); buffer.append("_"); buffer.append(operationName); sensorName = buffer.toString(); sensorNames.put(operationName, sensorName); } return (String)sensorName; }
/** * INTERNAL: * Process the JPA named query into an EclipseLink Session query. This * method is called after descriptor initialization. */ protected void processJPAQuery(DatabaseQuery jpaQuery) { // This is a hack, to allow the core Session to initialize JPA queries, without have a dependency on JPA. // They need to be initialized after login, as the database platform must be known. try { jpaQuery.prepareInternal(this); } catch (RuntimeException re) { // If jpql-tolerate-error==true, any problems will be ignored at query prep time and the runtime will // continue chugging along. The invalid query will be left in place so that an exception // will be thrown at runtime if a user attempts to use it. if (!tolerateInvalidJPQL) { throw re; } } DatabaseQuery databaseQuery = (DatabaseQuery) jpaQuery.getProperty("databasequery"); databaseQuery = (databaseQuery == null) ? jpaQuery : databaseQuery; addQuery(databaseQuery, false); // this should be true but for backward compatibility it // is set to false. }
/** * INTERNAL: * Process the JPA named query into an EclipseLink Session query. This * method is called after descriptor initialization. */ protected void processJPAQuery(DatabaseQuery jpaQuery) { // This is a hack, to allow the core Session to initialize JPA queries, without have a dependency on JPA. // They need to be initialized after login, as the database platform must be known. try { jpaQuery.prepareInternal(this); } catch (RuntimeException re) { // If jpql-tolerate-error==true, any problems will be ignored at query prep time and the runtime will // continue chugging along. The invalid query will be left in place so that an exception // will be thrown at runtime if a user attempts to use it. if (!tolerateInvalidJPQL) { throw re; } } DatabaseQuery databaseQuery = (DatabaseQuery) jpaQuery.getProperty("databasequery"); databaseQuery = (databaseQuery == null) ? jpaQuery : databaseQuery; addQuery(databaseQuery, false); // this should be true but for backward compatibility it // is set to false. }
/** * Update the rows on the database. Assume the call is correct. * @exception DatabaseException - an error has occurred on the database. */ public Integer updateAll() throws DatabaseException { if(((UpdateAllQuery)this.query).isPreparedUsingTempStorage() && getExecutionSession().getPlatform().supportsTempTables()) { return updateAllUsingTempTables(); } else { Integer rowCount = executeNoSelectCall(); if(((UpdateAllQuery)this.query).isPreparedUsingTempStorage()) { // the query was prepared using Oracle anonymous block AbstractRecord outputRow = (AbstractRecord)this.query.getProperty("output"); rowCount = (Integer)outputRow.get("ROW_COUNT"); } return rowCount; } }
/** * Update the rows on the database. Assume the call is correct. * @exception DatabaseException - an error has occurred on the database. */ public Integer updateAll() throws DatabaseException { if(((UpdateAllQuery)this.query).isPreparedUsingTempStorage() && getExecutionSession().getPlatform().supportsTempTables()) { return updateAllUsingTempTables(); } else { Integer rowCount = executeNoSelectCall(); if(((UpdateAllQuery)this.query).isPreparedUsingTempStorage()) { // the query was prepared using Oracle anonymous block AbstractRecord outputRow = (AbstractRecord)this.query.getProperty("output"); rowCount = (Integer)outputRow.get("ROW_COUNT"); } return rowCount; } }
/** * Update the rows on the database. Assume the call is correct. * @exception DatabaseException - an error has occurred on the database. */ public Integer updateAll() throws DatabaseException { if(((UpdateAllQuery)this.query).isPreparedUsingTempStorage() && getSession().getPlatform().supportsTempTables()) { return updateAllUsingTempTables(); } else { Integer rowCount = executeNoSelectCall(); if(((UpdateAllQuery)this.query).isPreparedUsingTempStorage()) { // the query was prepared using Oracle anonymous block AbstractRecord outputRow = (AbstractRecord)this.query.getProperty("output"); rowCount = (Integer)outputRow.get("ROW_COUNT"); } return rowCount; } }