Examples of CassandraPersistentProperty


Examples of org.springframework.data.cassandra.mapping.CassandraPersistentProperty

    }

    if (prop.isCompositePrimaryKey()) {

      // get the key
      CassandraPersistentProperty keyProperty = entity.getIdProperty();
      Object key = wrapper.getProperty(keyProperty);
      if (key == null) {
        key = instantiatePrimaryKey(keyProperty.getCompositePrimaryKeyEntity(), keyProperty, row);
      }

      // wrap the key
      BeanWrapper<Object> keyWrapper = BeanWrapper.create(key, conversionService);
View Full Code Here

Examples of org.springframework.data.cassandra.mapping.CassandraPersistentProperty

        where.and(QueryBuilder.eq(entry.getKey(), entry.getValue()));
      }
      return;
    }

    CassandraPersistentProperty idProperty = entity.getIdProperty();
    if (idProperty != null) {

      if (idProperty.isCompositePrimaryKey()) {
        writeDeleteWhereFromWrapper(BeanWrapper.create(id, conversionService), where,
            idProperty.getCompositePrimaryKeyEntity());
        return;
      }

      where.and(QueryBuilder.eq(idProperty.getColumnName().toCql(), id));
      return;
    }
  }
View Full Code Here

Examples of org.springframework.data.cassandra.mapping.CassandraPersistentProperty

    if (object instanceof MapIdentifiable) {
      return ((MapIdentifiable) object).getMapId();
    }

    CassandraPersistentProperty idProperty = entity.getIdProperty();
    if (idProperty != null) {
      return wrapper.getProperty(entity.getIdProperty(), idProperty.getType());
    }

    // if the class doesn't have an id property, then it's using MapId
    final MapId id = id();
    entity.doWithProperties(new PropertyHandler<CassandraPersistentProperty>() {
View Full Code Here

Examples of org.springframework.data.cassandra.mapping.CassandraPersistentProperty

  @Override
  public ID getId(T entity) {

    Assert.notNull(entity);

    CassandraPersistentProperty idProperty = entityMetadata.getIdProperty();
    if (idProperty != null) {
      return (ID) BeanWrapper.create(entity, null).getProperty(idProperty);
    }

    return (ID) converter.getId(entity, entityMetadata);
View Full Code Here

Examples of org.springframework.data.cassandra.mapping.CassandraPersistentProperty

  @Override
  protected Clause create(Part part, Iterator<Object> iterator) {

    PersistentPropertyPath<CassandraPersistentProperty> path = context.getPersistentPropertyPath(part.getProperty());
    CassandraPersistentProperty property = path.getLeafProperty();
    Clause criteria = from(part, property,
        null /* TODO where(path.toDotPath(CassandraPersistentProperty.PropertyToFieldNameConverter.INSTANCE))*/,
        iterator);

    return criteria;
View Full Code Here

Examples of org.springframework.data.cassandra.mapping.CassandraPersistentProperty

    if (base == null) {
      return create(part, iterator);
    }

    PersistentPropertyPath<CassandraPersistentProperty> path = context.getPersistentPropertyPath(part.getProperty());
    CassandraPersistentProperty property = path.getLeafProperty();

    return from(part, property,
        null /* TODO base.and(path.toDotPath(CassandraPersistentProperty.PropertyToFieldNameConverter.INSTANCE))*/,
        iterator);
  }
 
View Full Code Here

Examples of org.springframework.data.cassandra.mapping.CassandraPersistentProperty

  @Test
  public void validateMappingInfo() {

    Field field = ReflectionUtils.findField(Thing.class, "id");
    CassandraPersistentProperty property = new BasicCassandraPersistentProperty(field, null, thing, SIMPLE_TYPE_HOLDER);
    assertTrue(property.isIdProperty());
    assertTrue(property.isCompositePrimaryKey());

    List<CqlIdentifier> expectedColumnNames = Arrays.asList(new CqlIdentifier[] { cqlId("z"), cqlId("a") });
    assertTrue(expectedColumnNames.equals(property.getColumnNames()));

    List<CqlIdentifier> actualColumnNames = new ArrayList<CqlIdentifier>();
    List<CassandraPersistentProperty> properties = property.getCompositePrimaryKeyProperties();
    for (CassandraPersistentProperty p : properties) {
      actualColumnNames.addAll(p.getColumnNames());
    }
    assertTrue(expectedColumnNames.equals(actualColumnNames));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.