Skip to content

Commit

Permalink
DATACASS-142: fixed reported issue
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewadams committed Sep 12, 2014
1 parent c86b32f commit 1f7cbc4
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,18 @@ protected void writeDeleteWhereFromObject(final Object object, final Where where
protected void writeDeleteWhereFromWrapper(final BeanWrapper<Object> wrapper, final Where where,
CassandraPersistentEntity<?> entity) {

// if the entity itself if a composite primary key, then we've recursed, so just add columns & return
if (entity.isCompositePrimaryKey()) {
entity.doWithProperties(new PropertyHandler<CassandraPersistentProperty>() {
@Override
public void doWithPersistentProperty(CassandraPersistentProperty p) {
where.and(QueryBuilder.eq(p.getColumnName().toCql(), wrapper.getProperty(p)));
}
});
return;
}

// else, wrapper is an entity with an id
Object id = getId(wrapper, entity);
if (id == null) {
String msg = String.format("no id value found in object {}", wrapper.getBean());
Expand Down Expand Up @@ -335,7 +347,7 @@ public Object getId(Object object, CassandraPersistentEntity<?> entity) {

final BeanWrapper<?> wrapper = object instanceof BeanWrapper ? (BeanWrapper<?>) object : BeanWrapper.create(object,
conversionService);
object = wrapper == null ? object : wrapper.getBean();
object = wrapper.getBean();

if (!entity.getType().isAssignableFrom(object.getClass())) {
throw new IllegalArgumentException(String.format(
Expand Down

0 comments on commit 1f7cbc4

Please sign in to comment.