Package org.apache.ojb.broker.query

Examples of org.apache.ojb.broker.query.Query


    public MutablePortletEntity getPortletEntity( ObjectID id )
    {
        Criteria c = new Criteria();
        c.addEqualTo("id", id.toString());
        Query q = QueryFactory.newQuery(PortletEntityImpl.class, c);
        MutablePortletEntity portletEntity = (MutablePortletEntity) getPersistenceBrokerTemplate().getObjectByQuery(q);
        if (portletEntity == null)
        {
            return null;
        }
View Full Code Here


    {
      clazz = pClazz;
      broker = pBroker;
      pmi = pPmi;
        Criteria selectExtent = null;
        Query q = QueryFactory.newQuery(clazz, selectExtent);
       
        // the PB loads plain java objects
        Collection pojoInstances = broker.getCollectionByQuery(q);
        // To bring these instances under JDO management,
        // each instance must be provided with its own StateManager
View Full Code Here

        TransactionImpl tx = getTransaction();
        if (tx == null) throw new QueryInvalidException("Need running transaction to do query");

        OQLQuery predicateQuery = tx.getImplementation().newOQLQuery();
        predicateQuery.create(oql);
        Query pQ = ((OQLQueryImpl) predicateQuery).getQuery();
        Criteria pCrit = pQ.getCriteria();

        PBCapsule handle = new PBCapsule(pbKey, tx);
        DList result;
        try
        {
            PersistenceBroker broker = handle.getBroker();
            Criteria allElementsCriteria = this.getPkCriteriaForAllElements(broker);
            // join selection of elements with predicate criteria:
            allElementsCriteria.addAndCriteria(pCrit);

            Class clazz = null;
            try
            {
                clazz = this.getElementsExtentClass(broker);
            }
            catch (PersistenceBrokerException e)
            {
                getLog().error(e);
                throw new ODMGRuntimeException(e.getMessage());
            }
            Query q = new QueryByCriteria(clazz, allElementsCriteria);
            if (getLog().isDebugEnabled()) getLog().debug(q.toString());

            result = null;
            try
            {
                result = (DList) broker.getCollectionByQuery(DListImpl.class, q);
View Full Code Here

        try
        {
//      Query query = QueryPool.getQuery(queryString);
            // Use the OQL parser to transform a query string to a valid org.apache.ojb.broker.query object
            Query _query;
            StringReader reader = new StringReader(queryString);
            OQLLexer lexer = new OQLLexer(reader);
            OQLParser parser = new OQLParser(lexer);
            _query = parser.buildQuery();
            setBindIterator(flatten(_query.getCriteria(), new Vector()).listIterator());
            _query.setStartAtIndex(startAtIndex);
            _query.setEndAtIndex(endAtIndex);
            setQuery(_query);
        }
        catch (RecognitionException e)
        {
            throw new QueryInvalidException(e.getMessage());
View Full Code Here

  super(state,3);
  tokenNames = _tokenNames;
}

  public final Query  buildQuery() throws RecognitionException, TokenStreamException {
    Query query = null;
   
   
    try {      // for error handling
      query=selectQuery();
      {
View Full Code Here

      recover(ex,_tokenSet_4);
    }
  }
 
  public final Query  existsQuery() throws RecognitionException, TokenStreamException {
    Query query = null;
   
   
    try {      // for error handling
     
      Class clazz = null;
View Full Code Here

  ) throws RecognitionException, TokenStreamException {
   
   
    try {      // for error handling
     
      Query subQuery = null;
      boolean negative = false;
     
      {
      if ((LA(1)==LITERAL_not)) {
        match(LITERAL_not);
View Full Code Here

         */
        public Object execute() throws org.odmg.QueryException
        {
            Collection result;
            Iterator iter = null;
            Query query = getQuery();

            try
            {
                if (!(query instanceof ReportQuery))
                {
View Full Code Here

        PersistenceBroker broker = capsule.getBroker();

        try
        {
            predicateQuery.create(oql);
            Query pQ = ((OQLQueryImpl) predicateQuery).getQuery();
            Criteria pCrit = pQ.getCriteria();

            Criteria allElementsCriteria = this.getPkCriteriaForAllElements(broker);
            // join selection of elements with predicate criteria:
            pCrit.addAndCriteria(allElementsCriteria);
            Class clazz = this.getElementsExtentClass(broker);
            Query q = new QueryByCriteria(clazz, pCrit);
            if (log.isDebugEnabled()) log.debug(q.toString());
            // 2. perfom query
            return (DSetImpl) broker.getCollectionByQuery(DSetImpl.class, q);
        }
        catch (PersistenceBrokerException e)
        {
View Full Code Here

        {
            log.debug("Retrieving all products");
        }

        // 1. build a query that select all objects of Class Product, without any further criteria
        Query             query  = new QueryByCriteria(Product.class, null);
        PersistenceBroker broker = null;
        Collection        result = null;

        try
        {
View Full Code Here

TOP

Related Classes of org.apache.ojb.broker.query.Query

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.