Firebrind OCM

16 views
Skip to first unread message

Rafael Neves

unread,
May 13, 2013, 1:54:56 PM5/13/13
to hector...@googlegroups.com
Hi guys,

I trying retrieve all data on my column family using method persistenceFactory.getColumns("Geral2", "b25b4b70-bbd2-11e2-8f3e-90b11cf59ca2",false, "dinName", "dinEnd"); 

this don't work when I have created my column family using follow method:  persistenceFactory.executeQuery(Integer.class, Query.get(createColumnFamily(
columnFamily("Geral2"),
   columnDefinitions(
       primaryKey("myKey", ColumnDataType.UUID),
       column("dinName", ColumnDataType.TEXT),
       column("dinEnd", ColumnDataType.TEXT)
   ),
   storageOptions(
       storageOption(StorageParameter.COMMENT, "comment"),
       storageOption(StorageParameter.READ_REPAIR_CHANCE, "1")
   )
)));

so, I create this index:
persistenceFactory.executeQuery(Integer.class, Query.get(createIndex(
onColumnFamily("Geral2"),
indexName("myIndex"),
column("dinName")
)));

but I have the follow error:
Exception in thread "main" me.prettyprint.hector.api.exceptions.HInvalidRequestException: InvalidRequestException(why:No indexed columns present in by-columns clause with "equals" operator)


in cassandra-cli I see the index created.

any suggestion or solution, please?


Raul Raja Martinez

unread,
May 14, 2013, 3:46:02 AM5/14/13
to hector...@googlegroups.com
Rafael, This is more of a firebrand question than related to Hector. I will answer it here though but feel free to post any other question related to FirebrandOCM at https://github.com/47deg/firebrand/issues

The PersistenceFactory.getColumns method assumes you are using mapped objects and uses KEY as the key name to lookup columns, it also uses default key validation UTF8 instead of UUID. 

If you change it to… primaryKey("KEY", ColumnDataType.TEXT) it should work. 
Also I believe you don't need the index unless you plan on querying based on criteria on those columns.

You can simply consider using the mapper to map those columns to a bean and simply use the "persist" and "get" methods to transparently save and retrieve objects

Entity entity = ...;
entity.setName(name);
persistenceFactory.persist(entity)
Entity entity = peristenceFactory.get(Entity.class, key);






--
You received this message because you are subscribed to the Google Groups "hector-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hector-users...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
--
Raúl Raja Martínez
Co-founder @ 47 Degrees

Rafael Neves

unread,
May 14, 2013, 8:39:30 AM5/14/13
to hector...@googlegroups.com
Raul,

I have this code now:

persistenceFactory.executeQuery(Integer.class, Query.get(createColumnFamily(
columnFamily("LastTest"),
   columnDefinitions(
       primaryKey("key_validation_class", ColumnDataType.TEXT),
       column("testDesc", ColumnDataType.TEXT)
   ),
   storageOptions(
       storageOption(StorageParameter.COMMENT, "comment"),
       storageOption(StorageParameter.READ_REPAIR_CHANCE, "1")
   )
)));
persistenceFactory.executeQuery(Integer.class, Query.get(createIndex(
onColumnFamily("LastTest"),

column("testDesc")
)));
persistenceFactory.getColumns("LastTest", "b25b4b70-bbd2-11e2-8f3e-90b11cf59ca2",true, "testDesc");

and the problem persist!
I have chamnge the type of primaryKey for ColumnDataType.TEXT) but don't solved my problem.
I get the same error:
Exception in thread "main" me.prettyprint.hector.api.exceptions.HInvalidRequestException: InvalidRequestException(why:No indexed columns present in by-columns clause with "equals" operator)



2013/5/14 Raul Raja Martinez <raul...@gmail.com>



--
Att,
Rafael Neves
Formando em Análise e Desenvolvimento de Sistemas
Cursando pós em Engenharia de Software
Analista Júnior!!!

Contato: Ranev...@gmail.com

Rafael Neves

unread,
May 14, 2013, 9:08:15 AM5/14/13
to hector...@googlegroups.com
this method "getColumns" functionally normal if is using on Column Family created by Cassandra-cli, but don't work for column family created by method createColumnFamily of Firebrand :(


2013/5/14 Rafael Neves <ranev...@gmail.com>

Raul Raja Martinez

unread,
May 14, 2013, 9:56:45 AM5/14/13
to hector...@googlegroups.com
try primaryKey("KEY", ColumnDataType.TEXT) 

Rafael Neves

unread,
May 14, 2013, 10:22:51 AM5/14/13
to hector...@googlegroups.com
thanks for u help, this solved my problem!

I trying using firebrand on new project and I need more documentation about this framework.

:)
Reply all
Reply to author
Forward
0 new messages