Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * Copyright (c) 2009 Mysema Ltd.
  * All rights reserved.
  * 
  */
 package com.mysema.query.jdoql;
 
 
JDOQLSubQuery is subquery implementation for JDOQL

Author(s):
tiwe
public class JDOQLSubQuery extends DetachableQuery<JDOQLSubQuery>{
    
    
    public JDOQLSubQuery() {
        this(new DefaultQueryMetadata());
    }
    
    

Parameters:
metadata
    public JDOQLSubQuery(QueryMetadata metadata) {
        super(new JDOQLQueryMixin<JDOQLSubQuery>(metadata));
        this..setSelf(this);
    }
    
    public JDOQLSubQuery from(PEntity<?>... args) {
        return .from(args);
    }
    public <P> JDOQLSubQuery from(Path<? extends Collection<P>> targetPEntity<P> alias){
        .getMetadata().addFrom(OSimple.create(alias.getType(), .target.asExpr(), alias));
        return this;
    }
    
    @Override
    public String toString(){
        if (!.getMetadata().getJoins().isEmpty()){
            Expr<?> source = .getMetadata().getJoins().get(0).getTarget();
            JDOQLSerializer serializer = new JDOQLSerializer(.source);
            serializer.serialize(.getMetadata(), falsefalse);
            return serializer.toString().trim();
        }else{
            return super.toString();
        } 
    }
New to GrepCode? Check out our FAQ X