Exemplo n.º 1
0
 /**
  * Get Data for identification variable.
  *
  * @param idVarNode A node that corresponds to
  * @return
  */
 private IdentificationVariableData getIdentificationVarData(EJBQLAST idVarNode) {
   JavaType entityJavaType = (JavaType) idVarNode.getTypeInfo();
   assert entityJavaType != null
       : "This method is to be called only for" // NOI18N
           + "node that corresponds to identification variable."; // NOI18N
   String navigationId = idVarNode.getNavigationId();
   return selectPlan.getIdentificationVariableData(entityJavaType, navigationId);
 }
Exemplo n.º 2
0
  /**
   * Process user parameters. User parameters of type PersistenceCapable are treated specially.
   *
   * @param node The node represting pararmeter in query tree
   * @return If the parameter corresponds to a PersistenceCapable type, the text of the node as it
   *     is. Please note that by convention, all methods processing where clause rerturn a
   *     StringBuffer. This methos deviates from the convention for parameter of PersistenceCapable
   *     type. However, for this type of parameter, the return value of this method will always go
   *     into method leaveRelationalExpresionEntityEqual() which will always return a Stringbuffer.
   *     Else a StringBuffer representing parameter marker.
   */
  @Override
  public Object leaveParameter(EJBQLAST node) {
    // TODO: As per discussion on conf call on 05/05, it should be possible to
    // extract enough information while in this method to get hold of RunTimeMappingField
    // (That is atleast String entityType and String fieldName).
    // This information is required for embedded objects and object cocomparison
    // for objects with composite pk to construct correct sql text and parameters
    Object retVal;
    JavaType javaType = (JavaType) node.getTypeInfo();
    if (javaType.isPersistenceCapable()) {
      // If this corresponds to an entity mapped to composite pk, this
      // parameter will translate into multiple parameter markers in the
      // generated sql. Let leaveRelationalExpresionEntityEqual handle this
      // case
      retVal = selectPlan.getParameterData(javaType, node.getText());

    } else {
      // The parameter will have exactly one parameter marker in the
      // generated sql text. Add the parameter to plan.
      retVal = selectPlan.addUserParameter(node.getText());
    }
    return retVal;
  }
Exemplo n.º 3
0
 /**
  * For query Select .. from Department d...., This method is called for expression Department.
  *
  * @param node The node in query tree that corresponds to the experssion.
  * @return fully qualified name of the javaType of this node.
  */
 @Override
 public String leaveAbstractSchemaName(EJBQLAST node) {
   JavaType javaType = (JavaType) node.getTypeInfo();
   return javaType.getName();
 }