/ / redis eccezione nel codice java jedis - redis, jedis

redis eccezione nel codice java jedis - redis, jedis

Ho questo codice su java tramite jedis:

int shb1 = jds.storeHypnoBeats(id1, arr1);

che chiama questa funzione:

int storeHypnoBeats(String id,byte[] data)
{
db.lpush(id.getBytes(),data);
return 1;

}

ma quando eseguo il codice java ottengo questa eccezione:

Exception in thread "main" redis.clients.jedis.exceptions.JedisDataException: ERR Operation against a key holding the wrong kind of value

ecco la definizione di arr1 e id:

byte[] arr1 = new byte[]{1,2,3,4,5,6,7,8,9};
String id1 = "id1";

ogni cosa è corretta come ho controllato, perché devo farlo ?!

Grazie in anticipo

risposte:

0 per risposta № 1

id.getBytes() restituisce una matrice di byte ma firma di lpush è:

public Long lpush(String key,String... strings)

Pertanto, la chiave deve essere string non un array of byte.