compound keys renaming
This commit is contained in:
@@ -22,7 +22,6 @@ import org.springframework.beans.factory.BeanClassLoaderAware;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.cassandra.core.CassandraOperations;
|
||||
import org.springframework.cassandra.core.CassandraTemplate;
|
||||
import org.springframework.data.cassandra.core.SpringDataKeyspace;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -32,9 +31,11 @@ import org.springframework.data.cassandra.convert.CassandraConverter;
|
||||
import org.springframework.data.cassandra.convert.MappingCassandraConverter;
|
||||
import org.springframework.data.cassandra.core.CassandraAdminOperations;
|
||||
import org.springframework.data.cassandra.core.CassandraAdminTemplate;
|
||||
import org.springframework.data.cassandra.core.SpringDataKeyspace;
|
||||
import org.springframework.data.cassandra.mapping.CassandraMappingContext;
|
||||
import org.springframework.data.cassandra.mapping.CassandraPersistentEntity;
|
||||
import org.springframework.data.cassandra.mapping.CassandraPersistentProperty;
|
||||
import org.springframework.data.cassandra.mapping.CompoundKey;
|
||||
import org.springframework.data.cassandra.mapping.Table;
|
||||
import org.springframework.data.mapping.context.MappingContext;
|
||||
import org.springframework.util.ClassUtils;
|
||||
@@ -74,8 +75,8 @@ public abstract class AbstractCassandraConfiguration implements BeanClassLoaderA
|
||||
public abstract Cluster cluster() throws Exception;
|
||||
|
||||
/**
|
||||
* Creates a {@link Session} to be used by the {@link SpringDataKeyspace}. Will use the {@link Cluster} instance configured in
|
||||
* {@link #cluster()}.
|
||||
* Creates a {@link Session} to be used by the {@link SpringDataKeyspace}. Will use the {@link Cluster} instance
|
||||
* configured in {@link #cluster()}.
|
||||
*
|
||||
* @see #cluster()
|
||||
* @see #Keyspace()
|
||||
@@ -93,8 +94,8 @@ public abstract class AbstractCassandraConfiguration implements BeanClassLoaderA
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a {@link SpringDataKeyspace} to be used by the {@link CassandraTemplate}. Will use the {@link Session} instance
|
||||
* configured in {@link #session()} and {@link CassandraConverter} configured in {@link #converter()}.
|
||||
* Creates a {@link SpringDataKeyspace} to be used by the {@link CassandraTemplate}. Will use the {@link Session}
|
||||
* instance configured in {@link #session()} and {@link CassandraConverter} configured in {@link #converter()}.
|
||||
*
|
||||
* @see #cluster()
|
||||
* @see #Keyspace()
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright 2010-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.cassandra.mapping;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Inherited;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Identifies compound keys class in the Cassandra table that contains several fields. Same as
|
||||
*
|
||||
* @org.springframework.data.annotation.Id
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* @CompoundKey class AccountPK { String account; String region; }
|
||||
*
|
||||
* @Table class Account {
|
||||
* @PrimaryKey AccountPK pk; }
|
||||
*
|
||||
*
|
||||
* @author Alex Shvid
|
||||
*/
|
||||
|
||||
@Inherited
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ ElementType.TYPE })
|
||||
public @interface CompoundKey {
|
||||
|
||||
}
|
||||
@@ -20,25 +20,13 @@ import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
|
||||
/**
|
||||
* Identifies composite row ID in the Cassandra table that contains several fields. Same as
|
||||
* @org.springframework.data.annotation.Id
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* class AccountPK { String account; String region; }
|
||||
*
|
||||
* @Table class Account {
|
||||
* @CompositeRowId Account pk; }
|
||||
*
|
||||
* Identifies partition key in the Cassandra compound key class.
|
||||
*
|
||||
* @author Alex Shvid
|
||||
*/
|
||||
@Retention(value = RetentionPolicy.RUNTIME)
|
||||
@Target(value = { ElementType.FIELD, ElementType.METHOD, ElementType.ANNOTATION_TYPE })
|
||||
@Id
|
||||
public @interface CompositeRowId {
|
||||
public @interface PartitionKey {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user