valchkou / cassandra-driver-mapping

JPA addon for DataStax Java Driver for Cassandra
58 stars 24 forks source link

Indexes disappear on second sync #22

Closed valchkou closed 10 years ago

valchkou commented 10 years ago

on behalf of user

I'm using your library and it looks good. But when my app reconnect to Cassandra it drops column indexes for entities on the SchemaSync.sync(); when it does MappingSession().

For the first connection session all tables were created normally, with all needed indexes. But on the second connection all indexes disappeared. Could you have a look on it?

valchkou commented 10 years ago

I have unittest which covers alter and index scenarios. Tests pass OK. So , to figure what's wrong I need more details on your usecase.

yarroha commented 10 years ago

Here is my entity class. http://pastebin.com/h0fdm70d I do not altering anything. But when I relaunch my app it decides to resync entity and remove "action_serverId_idx" index. Environment: Cassandra 2.0.8, Oracle Java 8, ubuntu 12.04.

yarroha commented 10 years ago

Ok, Cassandra save index name in lowercase. Even it was described in CamelCase. So, on the second connection it comperes serverId with serverid. Have a look here: http://www.datastax.com/dev/blog/cql3-evolutions part about Case sensitivity

yarroha commented 10 years ago

In CQL2, the PRIMARY KEY was case insensitive, but all other column identifiers where case sensitive. So we have cleaned that up in CQL3. In CQL3, identifiers (keyspace/table/columns names) are always case insensitive by default.

Double quotes in the @Index annotation doesn't pass to Cassandra correctly. But when you force column name and set columnList all works fine http://pastebin.com/bxnSGuCH

valchkou commented 10 years ago

Please, refresh from maven. should work now.