You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@gora.apache.org by Henry JunYoung Kim <he...@gmail.com> on 2012/08/26 07:38:32 UTC

better idea to use byte[] as a keyClass

Hi, 
I am new for Gora.

to define keyClass, currently I describe it as bytes like this.

{
  "type": "record",
  "name": "Twitter",
  "namespace": "net.daum.drp.bifrost.storage.generated",
  "fields" : [
    {"name": "id", "type":"bytes"},
    {"name": "url", "type": "string"},
    {"name": "timestamp", "type": "long"},
    {"name": "contents", "type": "string"}
  ]
}

and in an application, I created an instance to use Twitter class.


private DataStore<ByteBuffer, Twitter> dataStore;

but, this DataStore instance causes an error to use. 

org.apache.gora.util.GoraException: java.lang.RuntimeException: java.lang.IllegalStateException: tableName is not specified
	at org.apache.gora.store.DataStoreFactory.createDataStore(DataStoreFactory.java:167)
	at org.apache.gora.store.DataStoreFactory.getDataStore(DataStoreFactory.java:278)
	at net.daum.drp.bifrost.storage.App.<init>(App.java:19)
	at net.daum.drp.bifrost.storage.App.main(App.java:78)
Caused by: java.lang.RuntimeException: java.lang.IllegalStateException: tableName is not specified
	at org.apache.gora.hbase.store.HBaseStore.initialize(HBaseStore.java:125)
	at org.apache.gora.store.DataStoreFactory.initializeDataStore(DataStoreFactory.java:102)
	at org.apache.gora.store.DataStoreFactory.createDataStore(DataStoreFactory.java:161)
	... 3 more
Caused by: java.lang.IllegalStateException: tableName is not specified
	at org.apache.gora.hbase.store.HBaseMapping$HBaseMappingBuilder.build(HBaseMapping.java:166)
	at org.apache.gora.hbase.store.HBaseStore.readMapping(HBaseStore.java:592)
	at org.apache.gora.hbase.store.HBaseStore.initialize(HBaseStore.java:111)
	... 5 more


in my guess, as a key type, ByteBuffer is not available. 

so, is there any better ideas to use byte array type as a key. 

ps) actually, in my needs, there is what I want to use a composite key.
this is is consists of Long, Long and unfixed String type data. 

thanks for your readings.