NoSqlManyToOne relation to entity with UUID as ID fails #67

Open
snazy opened this Issue Jan 16, 2013 · 5 comments

Projects

None yet

3 participants

snazy commented Jan 16, 2013

persisting an object that has a NoSqlManyToOne relation to another entity with UUID as ID type fails with "InvalidRequestException(why:String didn't validate.)"

Collaborator

I hope you are saying something like below:
Have an entity with UUID as ID

 @NoSqlEntity
 public class EntityWithUUIDKey {

@NoSqlId
private UUID id;

@NoSqlIndexed
private String something;
 }

Then in another entity have the above one as ManyToOne

  @NoSqlEntity
  public class User {

@NoSqlId
private String id;

@NoSqlManyToOne
private EntityWithUUIDKey uuidEntity;
 }

I tried to persist that and was able to successfully save. However, was getting NPE while making the build which I fixed now. So I could not reproduce the exact error but have done something. Can you try again? If you still get the error please tell us the structure of your entities and we will do the needful.
Closing this for the time being. Re-open it if you still face the issue.

Thanks,

@easility easility closed this Jan 17, 2013
snazy commented Jan 17, 2013

I still get the exception, if EntityWithUUID.id is of type com.eaio.uuid.UUID.
If EntityWithUUID.is is a java.lang.String, everything works fine.
Tested against an empty keyspace, too.

@NoSqlEntity
public class EntityWithUUID {
@NoSqlId
private UUID id;

@NoSqlIndexed
private String officialName;

}

@NoSqlEntity
public class MasterEntity {
@NoSqlId
private String id;

@NoSqlManyToOne
private EntityWithUUID otherEntity;

@NoSqlIndexed
private String fullName;

private String nickName;

}

    EntityWithUUID c = new EntityWithUUID();
    c.setOfficialName("Riesenschnauzer");
    entityManager.put(c);
    entityManager.flush();

    MasterEntity m = new MasterEntity();
    m.setNickName("Giant");
    m.setBreed(breed);
    entityManager.put(m);
    entityManager.flush();

java.lang.RuntimeException: com.netflix.astyanax.connectionpool.exceptions.BadRequestException: BadRequestException: [host=localhost(127.0.0.1):9160, latency=1(1), attempts=1]InvalidRequestException(why:String didn't validate.)
at com.alvazan.orm.layer9z.spi.db.cassandra.CassandraSession.sendChanges(CassandraSession.java:114)
at com.alvazan.orm.logging.NoSqlRawLogger.sendChanges(NoSqlRawLogger.java:51)
at com.alvazan.orm.layer5.nosql.cache.NoSqlWriteCacheImpl.flush(NoSqlWriteCacheImpl.java:137)
at com.alvazan.orm.layer5.nosql.cache.NoSqlReadCacheImpl.flush(NoSqlReadCacheImpl.java:179)
at com.alvazan.orm.layer0.base.BaseEntityManagerImpl.flush(BaseEntityManagerImpl.java:197)
at ...
Caused by: com.netflix.astyanax.connectionpool.exceptions.BadRequestException: BadRequestException: [host=localhost(127.0.0.1):9160, latency=1(1), attempts=1]InvalidRequestException(why:String didn't validate.)
at com.netflix.astyanax.thrift.ThriftConverter.ToConnectionPoolException(ThriftConverter.java:159)
at com.netflix.astyanax.thrift.AbstractOperationImpl.execute(AbstractOperationImpl.java:60)
at com.netflix.astyanax.thrift.AbstractOperationImpl.execute(AbstractOperationImpl.java:27)
at com.netflix.astyanax.thrift.ThriftSyncConnectionFactoryImpl$1.execute(ThriftSyncConnectionFactoryImpl.java:136)
at com.netflix.astyanax.connectionpool.impl.AbstractExecuteWithFailoverImpl.tryOperation(AbstractExecuteWithFailoverImpl.java:69)
at com.netflix.astyanax.connectionpool.impl.AbstractHostPartitionConnectionPool.executeWithFailover(AbstractHostPartitionConnectionPool.java:248)
at com.netflix.astyanax.thrift.ThriftKeyspaceImpl.executeOperation(ThriftKeyspaceImpl.java:442)
at com.netflix.astyanax.thrift.ThriftKeyspaceImpl.access$100(ThriftKeyspaceImpl.java:63)
at com.netflix.astyanax.thrift.ThriftKeyspaceImpl$1.execute(ThriftKeyspaceImpl.java:99)
at com.alvazan.orm.layer9z.spi.db.cassandra.CassandraSession.sendChangesImpl(CassandraSession.java:137)
at com.alvazan.orm.layer9z.spi.db.cassandra.CassandraSession.sendChanges(CassandraSession.java:112)
... 39 more
Caused by: InvalidRequestException(why:String didn't validate.)
at org.apache.cassandra.thrift.Cassandra$batch_mutate_result.read(Cassandra.java:20253)
at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:78)
at org.apache.cassandra.thrift.Cassandra$Client.recv_batch_mutate(Cassandra.java:922)
at org.apache.cassandra.thrift.Cassandra$Client.batch_mutate(Cassandra.java:908)
at com.netflix.astyanax.thrift.ThriftKeyspaceImpl$1$1.internalExecute(ThriftKeyspaceImpl.java:105)
at com.netflix.astyanax.thrift.ThriftKeyspaceImpl$1$1.internalExecute(ThriftKeyspaceImpl.java:102)
at com.netflix.astyanax.thrift.AbstractOperationImpl.execute(AbstractOperationImpl.java:55)
... 48 more

snazy commented Jan 17, 2013

Might it be a problem, if my test cassandra installation is just a "single node cluster" ??

Collaborator

Ah..I was tested it in in-memory database and there it was working fine. It is indeed a problem in Cassandra. Will look into it. Re-opening this.

@easility easility reopened this Jan 18, 2013
Owner

single node cluster should be fine. I know we worked a ticket for another customer where we detected if localhost was the server and automatically moved to CL=ONE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment