You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Ashish Soni <as...@gmail.com> on 2015/10/20 19:21:03 UTC

Cassandra Object Mapper - Dynamically pass keyspace value

Hi All ,

is there any way i can specify value of keyspace during compile time like
using maven build
hard coding keyspace name inside the java class is bit not comfortable as
if there a change and there are 1000's of files it become a big maintenance
issue

@UDT (keyspace = "complex", name = "address")public class Address {
    private String street;
    private String city;
    private int zipCode;

Re: Cassandra Object Mapper - Dynamically pass keyspace value

Posted by Ryan Svihla <rs...@foundev.pro>.
You should probably ask the java driver user list
https://groups.google.com/a/lists.datastax.com/forum/#!forum/java-driver-user
,

However I do have some suggestions (any follow up questions please ask on
the java driver list though):

   1. It's optional so you don't have to pass it (
   https://github.com/datastax/java-driver/blob/61a98e83cf35ae3e979d6073aeb40ba78eed11d5/driver-mapping/src/main/java/com/datastax/driver/mapping/annotations/UDT.java)
   and you can rely on the mapper knowing about the keyspace before you pass
   this (either via connect or a "USE command" on the session object (which is
   what I do in my project with the Table annotation).
   2. You can just rely on Java and delegate this to a static property
   which reads a configuration value from say a system property (which you can
   set in Maven using profiles for example).



On Tue, Oct 20, 2015 at 12:21 PM, Ashish Soni <as...@gmail.com> wrote:

> Hi All ,
>
> is there any way i can specify value of keyspace during compile time like
> using maven build
> hard coding keyspace name inside the java class is bit not comfortable as
> if there a change and there are 1000's of files it become a big maintenance
> issue
>
> @UDT (keyspace = "complex", name = "address")public class Address {
>     private String street;
>     private String city;
>     private int zipCode;
>
>


-- 

Thanks,
Ryan Svihla