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