Embedded Cassandra : Data inserted using Kundera not visible in CQL session

8 views
Skip to first unread message

Sohel Khan

unread,
Apr 27, 2018, 1:59:44 AM4/27/18
to cassandra-unit-users
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

embeddedCassandra.yaml
Reply all
Reply to author
Forward
0 new messages