public void addNamedQuery(String name, Query query) { DatabaseQuery unwrapped = (DatabaseQuery) query.unwrap(DatabaseQuery.class).clone(); if (((QueryImpl)query).lockMode != null){ ((ObjectLevelReadQuery)unwrapped).setLockModeType(((QueryImpl)query).lockMode.name(), session); } if (unwrapped.isReadQuery()){ ((ReadQuery)unwrapped).setInternalMax((((QueryImpl)query).getMaxResultsInternal())); if (query.getFirstResult() != QueryImpl.UNDEFINED){ ((ReadQuery)unwrapped).setFirstResult(query.getFirstResult()); } } this.getServerSession().addQuery(name, unwrapped, true); }
public void addNamedQuery(String name, Query query) { QueryImpl queryImpl = query.unwrap(QueryImpl.class); DatabaseQuery unwrapped = (DatabaseQuery) queryImpl.getDatabaseQueryInternal().clone(); if (queryImpl.lockMode != null){ ((ObjectLevelReadQuery)unwrapped).setLockModeType(queryImpl.lockMode.name(), getServerSession()); } if (unwrapped.isReadQuery()){ ((ReadQuery)unwrapped).setInternalMax((queryImpl.getMaxResultsInternal())); ((ReadQuery)unwrapped).setFirstResult((queryImpl.getFirstResult())); } this.getServerSession().addQuery(name, unwrapped, true); }
if (((ObjectLevelReadQuery) databaseQuery).setLockModeType(lockMode.name(), session)) { throw new PersistenceException(ExceptionLocalization.buildMessage("ejb30-wrong-lock_called_without_version_locking-index", null));
if (((ObjectLevelReadQuery)query).setLockModeType(lockMode.name(), (AbstractSession) getActiveSession())) { throw new PersistenceException(ExceptionLocalization.buildMessage("ejb30-wrong-lock_called_without_version_locking-index", null));