Impetus / kundera

A JPA 2.1 compliant Polyglot Object-Datastore Mapping Library for NoSQL Datastores.Please subscribe to:

Home Page:http://groups.google.com/group/kundera-discuss/subscribe

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Embedded Cassandra : Data not visible between Kundera and CQL sessions

sohelmk opened this issue · comments

Hi,
We are using kundera to persist data. During unit test we find that any data inserted using direct CQL is not available to Kundera and vice versa.
We tried flush etc on kundera session, but no luck.
Any data inserted in kundera can be queried back using kundera.
Any data inserted using CQL can be queries back using CQL

I am pasting relevant scala code that shows the two approaches

KUNDERA CODE (used to insert group objects and it works)

def create(group: Group): Either[String, String] = {
try {
val em = emf.createEntityManager()
em.persist(group)

  em.flush()
  em.clear()

  em.close()
  Right("Group has been created successfully.")
}
catch {
  case ex: Exception => logger.error("Error : ", ex); Left(ex.getMessage())
}

}

CQL CODE (used to query the group table in which rows are inserted by above)
EmbeddedCassandraServerHelper.startEmbeddedCassandra("embeddedCassandra.yaml"); //yaml file attached
session = EmbeddedCassandraServerHelper.getSession
resultSet = session.execute("SELECT * from group ");
if (resultSet.isExhausted())
println("No data in group");
else
println(resultSet.all().toString())

Note we are new to Cassandra, any help would be greatly appreciated.

Thanks,
Sohel

Hi @sohelmk,

You should be able to query any data of Cassandra (not only inserted by Kundera).

Are you using schema generation property in persistence.xml?
Please share your persistence.xml file.

Thanks Devender for your response. We found the root cause: It was use of schema-gen feature along with "keySpaceDeletion" flag in embedded Cassandra. It was causing all keyspaces to be recreated.

Kudos to Kundera!

Regards,
Sohel