Пример #1
0
  /**
   * Executes the query returning zero or many results as a list
   *
   * @return The results
   */
  public List list() {
    // flush before query execution in FlushModeType.AUTO
    if (session.getFlushMode() == FlushModeType.AUTO) {
      session.flush();
    }

    return executeQuery(entity, criteria);
  }
Пример #2
0
 private Object resolveIdIfEntity(Object value) {
   // use the object id as the value if its a persistent entity
   if (session.getMappingContext().isPersistentEntity(value)) {
     EntityPersister ep = (EntityPersister) session.getPersister(value);
     value = ep.getObjectIdentifier(value);
   }
   return value;
 }
Пример #3
0
 public Junction add(Criterion c) {
   if (c != null) {
     if (c instanceof Equals) {
       final Equals eq = (Equals) c;
       Object value = eq.getValue();
       Session session = AbstractDatastore.retrieveSession();
       if (session.getMappingContext().isPersistentEntity(value)) {
         EntityPersister ep = (EntityPersister) session.getPersister(value);
         c = new Equals(eq.getProperty(), ep.getObjectIdentifier(value));
       }
     }
     criteria.add(c);
   }
   return this;
 }
 public void initialize() {
   if (!initialized) {
     initialized = true;
     List results = indexer.query(associationKey);
     addAll(session.retrieveAll(indexer.getIndexedEntity().getJavaClass(), results));
   }
 }