Esempio n. 1
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;
  }
Esempio n. 2
0
 /** @return name of the field as String */
 @Override
 public Object leaveFieldCMRField(EJBQLAST node) {
   return node.getText();
 }
Esempio n. 3
0
 /** @return name of the field as String */
 @Override
 public String leaveFieldCMPField(EJBQLAST node) {
   return node.getText();
 }
Esempio n. 4
0
 @Override
 public StringBuffer leaveSingleCharStringLiteral(EJBQLAST node) {
   return selectPlan.getSingleCharExpr(node.getText());
 }
Esempio n. 5
0
 @Override
 public StringBuffer leaveWildcard(EJBQLAST node) {
   return new StringBuffer(node.getText());
 }
Esempio n. 6
0
 @Override
 public StringBuffer leaveLiteralString(EJBQLAST node) {
   return selectPlan.getStringExpr(node.getText());
 }
Esempio n. 7
0
 @Override
 public StringBuffer leaveLiteralDouble(EJBQLAST node) {
   return new StringBuffer(node.getText());
 }