예제 #1
0
  /**
   * INTERNAL: Return the lowlevel database accessor. The database accessor is used for direct
   * database access. The right accessor for this broker will be returned.
   */
  public Accessor getAccessor(Class domainClass) {
    if (domainClass == null) {
      // CR#... this occurs if a data query is used without a session-name, needs to throw an error
      throw QueryException.unnamedQueryOnSessionBroker(null);
    }

    // session may be a broker too.  Eventually a non session broker wil be found
    return getSessionForClass(domainClass).getAccessor(domainClass);
  }
예제 #2
0
  /** INTERNAL: Answers the session to be used for the given query. */
  protected AbstractSession getSessionForQuery(DatabaseQuery query) {
    if (query.hasSessionName()) {
      return getSessionForName(query.getSessionName());
    }

    Class queryClass;
    if (query.getDescriptor() != null) {
      queryClass = query.getDescriptor().getJavaClass();
    } else {
      queryClass = query.getReferenceClass();
      if (queryClass == null) {
        throw QueryException.unnamedQueryOnSessionBroker(query);
      }
    }
    return getSessionForClass(queryClass);
  }