Extra (Unwanted) Column Dynamically Added when using Mapping Feature. #104

mjensen opened this Issue Aug 14, 2012 · 3 comments


None yet

3 participants


I have a UserBean.java defined:

public class UserBean
    private String userId;

    private String firstName;

    private String lastName;


I have a column family defined as:

ColumnFamily<String, String> CF_USER = new ColumnFamily<String, String>(
    "Users", // Column Family Name
    StringSerializer.get(), // Key Serializer
    StringSerializer.get());  // Column Serializer

I have the ColumnFamily DDL defined in CQL:

    UserId text PRIMARY KEY,
    FirstName text,
    LastName text

I create a user like this:

String keyspaceName = "MyKeyspace";
Keyspace keyspace = cluster.getKeyspace(keyspaceName);

Mapping<UserBean> mapper = Mapping.make(UserBean.class);

// writing a bean
MutationBatch mutationBatch = keyspace.prepareMutationBatch();

ColumnListMutation<String> columnListMutation =
    mutationBatch.withRow(CF_USER, userBean.getUserId());

mapper.fillMutation(userBean, columnListMutation);

What I see in the database:

RowKey: username@somedomain.com 
=> (column=FirstName, value=SomeFirstName, timestamp=1344887503881001)
=> (column=LastName, value=SomeLastName, timestamp=1344887503881001)
=> (column=UserId, value=username@somedomain.com, timestamp=1344887503881001)

Please note the last column was dynamically added.

Since the UserId has the @Id annotation in the UserBean class, it should just show up as the RowKey and NOT be added as an extra column added dynamically.

It gets worse if you use a UUID type for your @Id in the bean as it will try to add a column dynamically that will fail validation because the default validation is UTF8, which is what I want for all my columns, just not the RowKey.


Elandau, what is your take on this getting into the next release?


mjensen, thank you for the detailed explanation. We agree with your point and are looking into changing it.

@stevenzwu stevenzwu was assigned Nov 28, 2012
Netflix, Inc. member
@elandau elandau closed this Jan 15, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment