animesh kumar

Running water never grows stale. Keep flowing!

Kundera: now JPA 1.0 Compatible

with 82 comments

[tweetmeme source=”anismiles” only_single=false

If you are new to Kundera, you should read Kundera: knight in the shining armor! to get a brief idea about it.

Kundera has reached a major milestone lately, so I thought to sum up the developments here. First and foremost, Kundera is now JPA 1.0 compatible, thought it doesn’t support relationships yet, it does support easy JPA style @Entity declarations and Linear JPA Queries. 🙂 Didn’t you always want to search over Cassandra?

To begin with let’s see what the changes are.

  1. Kundera do not have @CassandraEntity annotation anymore. It now expects JPA @Entity.
  2. Kundera specific @Id has been replaced with JPA @Id.
  3. Kundera specific @Column has been replaced with JPA @Column.
  4. @ColumnFamily, @SuperColumnFamily and @SuperColumn are still there, and are expected to be there for a long time to come, because JPA doesn’t have any of these ideas.
  5. @Index is introduced to control indexing of an entity bean. You can safely ignore it and let Kundera do the defaults for you.

I would recommend you to read about Entity annotation rules discussed in the earlier post. Apart from the points mentioned above, everything remains the same:

How to define an entity class?

@Entity						// makes it an entity class
@ColumnFamily("Authors")	// assign ColumnFamily type and name
public class Author {

	@Id	// row identifier
	String username;

	@Column(name = "email")	// override column-name
	String emailAddress;

	String country;

	@Column(name = "registeredSince")
	Date registered;

	String name;

	public Author() { // must have a default constructor

	// getters, setters etc.

There is an important deviation from JPA specification here.

  1. Unlike JPA you must explicitly annotate fields/properties you want to persist. Any field/property that is not @Column annotated will be ignored by Kundera.
  2. In short, the paradigm is reversed here. JPA assumes everything persist-able unless explicitly defined @Transient. Kundera expects everything transient unless explicitly defined @Column.

How to instantiate EntityManager?

Kundera expects some properties to be provided with before you can bootstrap it.

# Cassandra nodes to with Kundera will connect

#Cassandra port

#Cassandra keyspace which Kundera will use

#Whether or not EntityManager can have sessions, that is L1 cache.

#Cassandra client implementation. It must implement com.impetus.kundera.CassandraClient

You can define these properties in a java Map object, or in JPA persistence.xml or in a property file “” kept in the classpath.

  1. Instantiating with persistence.xml > Just replace the provider with com.impetus.kundera.ejb.KunderaPersistence which extends JPA PersistenceProvider. And either provide Kundera specific properties in the xml file or keep “” in the classpath.
  2. Instantiating in standard J2SE environment, with explicit Map object.
    Map map = new HashMap();
    map.put("kundera.nodes", "localhost");
    map.put("kundera.port", "9160");
    map.put("kundera.keyspace", "Blog");
    map.put("sessionless", "false");
    map.put("kundera.client", "com.impetus.kundera.client.PelopsClient");
    EntityManagerFactory factory = new EntityManagerFactoryImpl("test", map);
    EntityManager manager = factory.createEntityManager();
  3. Instantiating in standard J2SE environment, with “” file. Pass null to EntityManagerFactoryImpl and it will automatically look for the property file.
    EntityManagerFactory factory = new EntityManagerFactoryImpl("test", null);
    EntityManager manager = factory.createEntityManager();

Entity Operations

Once you have EntityManager object you are good to go, applying all your JPA skills. For example, if you want to find an Entity object by key,

	try {
		Author author = manager.find(Author.class, "smile.animesh");
	} catch (PersistenceException pe) {

Similarly, there are other JPA methods for various operations: merge, remove etc.

JPA Query

Note: Kundera uses Lucene to index your Entities. Beneath Lucene, Kundera uses Lucandra to store the indexes in Cassandra itself. One fun implication of using Lucene is that apart from regular JPA queries, you can also run Lucene queries. 😉

Here are some indexing fundamentals:

  1. By default, all entities are indexed along with with all @Column properties.
  2. If you do not want to index an entity, annotate it like, @Index (index=false)
  3. If you do not want to index a @column property of an entity, annotate it like, @Index (index=false)

That’s it. Here is an example of JPA query:

	// write a JPA Query
	String jpaQuery = "SELECT a from Author a";

	// create Query object
	Query query = manager.createQuery(jpaQuery);

	// get results
	List<Author> list = query.getResultList();
	for (Author a : list) {

Kundera also supports multiple “where” clauses with “AND”, “OR”, “=” and “like” operations.

	// find all Autors with email like anismiles
	String jpaQuery_for_emails_like = "SELECT a from Author a WHERE a.emailAddress like anismiles";

	// find all Authors with email like anismiles or username like anim
	String jpaQuery_for_email_or_name = "SELECT a from Author a WHERE a.emailAddress like anismiles OR a.username like anim";

I think this will enable you to play around with Kundera. I will be writing up more on how Kundera indexes various entities and how you can execute Lucene Queries in subsequent posts.

Kundera’s next milestones will be:

  1. Implementation of JPA listeners, @PrePersist @PostPersist etc.
  2. Implementation of Relationships, @OneToMany, @ManyToMany etc.
  3. Implementation of Transactional support, @Transactional

Written by Animesh

July 14, 2010 at 9:51 am

Posted in Technology

Tagged with , , , , ,

82 Responses

Subscribe to comments with RSS.

  1. […] Note: Kundera is now JPA 1.0 compatible, and there are some ensuing changes. You should read about it here: […]

    • Hi,
      I’d like to try using Kundera, you could publish the source code that demonstrates how it works with maven and spring jpa please?


      March 24, 2011 at 2:03 pm

  2. Excellent work, thanks for this great product.

    Hernan Moreno

    July 15, 2010 at 6:12 am

  3. Fantastic Work ! Well Done,
    where can I download this wonderful thing ?

    David Edson

    September 21, 2010 at 6:25 am

  4. I get a NullPointerException at the toString() method in the when trying to instantiate the EntityManagerFactory with a map. Any ideas how I could solve this problem?

    Martin Pinto

    October 20, 2010 at 8:51 pm

    • 1. Did it work okay without Map, i.e. with

      2. Did you define @Id attribute on your entity beans?



      October 20, 2010 at 9:03 pm

      • yes Animesh tried both ways, same exception.

        All my entity beans have the @Id annotation as well as the @Entity annotation.

        Martin Pinto

        October 22, 2010 at 2:06 pm

      • p.s.: this is the full exception:

        Exception in thread “main” java.lang.NullPointerException
        at com.impetus.kundera.metadata.EntityMetadata.toString(
        at java.lang.String.valueOf(
        at java.lang.StringBuilder.append(
        at com.impetus.kundera.ejb.EntityManagerFactoryImpl.(

        Martin Pinto

        October 22, 2010 at 6:39 pm

    • I’m getting the same error. Can this be given more insight?


      November 25, 2010 at 3:15 pm

      • We get this problem if Kundera code is compiled by using Eclipse instead of maven build script provided. To compile using Eclipse the below jar files need to be in the classpath.



        November 28, 2010 at 8:59 am

  5. Great work. Has this been used in production with a significant amount of traffic? I would like to use Cassandra as a high volume alternative to an application that is built using JPA. Rewriting DAO’s using the lower level Thrift APIs would be less desirable than an alternative that’s JPA compliant. My concern is that this may still be experimental?

    Regardless, I will give it a spin and send you feedback.


    October 21, 2010 at 10:35 pm

    • Alex, I am sure Kundera should be able to handle decent load. Some people have tried it and their feedback was satisfactory. However, you should take care of few things:

      1. Cassandra doesn’t support any sort of relations, but Kundera has written a layer to relate entities together. You should try to avoid relations as much as possible. they might slow down the performance.

      2. Keep an eye on Lucandra indexing. Lucandra sometimes behaves erratically. Kundera is being modified for Cassandra-0.7 support (that also includes secondary indexes)… hopefully we won’t need lucandra after that.



      October 22, 2010 at 8:13 am

    • Hi Alex,

      I can confirm that Kundera is very performant. We have Kundera currently deployed on our web application and have made several stress tests with very good results (took on average 5ms for reads / writes on a centrino 2 dual core with 2gb ram using ORM!). However due to the constant updates to Cassandra, using Kundera with Cassandra can be a pain in the a**. This is however, not the developers fault. For the most part, this framework is very stable.

      Martin Pinto

      October 22, 2010 at 5:20 pm

      • Martin, you made my day 🙂 I think that the performance of Kundera will further increase once Kundera starts supporting cassandra-0.7 version. that case, Lucandra will be replaced by native secondary indexes.

        I am sure, cassandra-0.7 is going to stay for a while. however, if you already have a cluster running in 0.6. migration would sure be a real pain. 🙂


        October 22, 2010 at 6:02 pm

  6. hello. i am trying to use nexus as my repository manager. i have already checked out and built the kundera-1.1.1-SNAPSHOT.jar. however, what are the steps for adding it to my nexus repository? i tried adding it to the ‘thirdparty’ repository, but it was rejected because it is a snapshot. any advice on getting this setup would be appreciated. thanks!


    October 22, 2010 at 11:39 am

    • I haven never worked with Nexus repository before. But, I guess if SNAPSHOT is causing the rump, why don’t you change the version to say 1.1.1 and go ahead with that. let me know if you can get it working.



      October 22, 2010 at 11:56 am

  7. thanks animesh. i’ll give that a try.


    October 23, 2010 at 8:59 am

  8. hello. i’m creating a junit4 test case that is trying to run a test method that instantiates a simple cassandra/jpa-annotated entity. i tried the following, but i just get a NPE. i have the persistence.xml file in the resources/META-INF directory, and the resources directory is on the classpath when the test is run. any ideas? thanks!

    public class UserTest {

    EntityManagerFactory emf;

    public void createUser() {

    try {
    EntityManager em = emf.createEntityManager();
    User user = new User();
    user.setDateRegistered(new Date());

    } catch (Exception e) {

    thanks again!


    October 27, 2010 at 11:35 am

  9. Animesh, first of all thanks for Kundera. Just downloaded the latest sources. Not sure what you mean by JPA compliant but most of the methods are unimplemented and the query parser fails with simple queries such as “property > value”. I have also noticed that there is no room for null properties on @Entity classes since the PropertyAccessorHelper returns byte[] and nullpointers are thrown whenever you try to persist an entity that contains null properties. I have also found misleading the fact that @Entity is required but also @ColumnFamily and @Column which has semantics of relational db columns are used as annotations for Cassandra columns. Doesn’t it make sense to include everything as column that is a primitive or type that has annotation and not create columns for null properties? Let me know if I’m missing the big picture here but I don’t see how Kundera is in any way usable at this point. At this point I’m fixing things as I go and trying to figure out how to do range queries.


    October 27, 2010 at 11:42 am

  10. an fyi…

    after adding all of the required maven dependencies, i tried running a simple test using kundera to store a User object in cassandra, but got the following exception:

    “Keyspace Lucandra does not exist in this schema”.

    in order to resolve this issue, i added the following to the cassandra storage-conf.xml file (found in the kundera source under /src/test/resources/storage-conf.xml):


    animesh, if this configuration is required in order to use kundera, can you please add it to the kundera-jpa tutorial above?

    thx! 🙂


    October 29, 2010 at 11:45 am

    • xml formatting didn’t come out right… 😦



      October 29, 2010 at 11:46 am

    • Kv, Kundera test-cases use embedded cassandra server which effectively uses /test/resources/storage-conf.xml.



      October 29, 2010 at 6:19 pm

  11. let’s try one more time…

    <Keyspace Name=”Lucandra”>
    <ColumnFamily Name=”TermInfo” CompareWith=”BytesType” ColumnType=”Super” CompareSubcolumnsWith=”BytesType” KeysCached=”10%” />
    <ColumnFamily Name=”Documents” CompareWith=”BytesType” KeysCached=”10%” />


    October 29, 2010 at 11:48 am

  12. is there a forum or mailing list for discussions about kundera? thx.


    October 30, 2010 at 11:57 am

  13. Nice work. Congratulations.

    Preliminary testing on project setup etc. was a breeze.

    However, I’m running into jpa query issues such as:

    works:”SELECT p from Person p WHERE p.age =”+query
    error:”SELECT p from Person p WHERE p.age >”+query

    works:”SELECT p from Person p WHERE p.first_name like “+query
    works:”SELECT p from Person p WHERE p.comment like “+query
    fails(nothing returned):”SELECT p from Person p WHERE p.comment like “+query+” OR p.first_name = ” +query ;


    November 2, 2010 at 4:58 am

  14. i tried to execute the following:

    Query q = em.createQuery(“select u from User u where like :email”);
    q.setParameter(“email”, email);
    User user = (User)q.getSingleResult();

    but i’m getting an org.apache.commons.lang.NotImplementedException.

    i looked at the source code for com.impetus.kundera.query.QueryImpl.getSingleResult() and it is indeed throwing a NotImplementedException.

    however, i looked at com.impetus.kundera.junit.QueryTest.testQueryAccrossManagerSessions() and it performs a similar query, which appears to succeed…?

    am i missing something, or are the jpa query operations not yet implemented by kundera?



    November 3, 2010 at 11:37 am

    • strange! it should work.


      November 5, 2010 at 5:21 pm

      • it works if you use q.getResultList(), but not if you use q.getSingleResult().



        November 11, 2010 at 12:13 pm

      • @Override
        public Object getSingleResult() {
        throw new NotImplementedException(“TODO”);

        Not implemented! 😦


        November 11, 2010 at 7:07 pm

  15. for the TODO in EntityManagerImpl.persist(Object e), would this work?

    // TODO: throw EntityExistsException if already exists
    Object primaryKey = metadata.getIdProperty().get(e);
    Object persistedObj = session.lookup(e.getClass(), primaryKey);
    if (persistedObj != null) {
    throw new PersistenceException(“Entity already exists.”);
    else {
    persistedObj = dataManager.find(e.getClass(), metadata, primaryKey.toString());
    if(persistedObj != null) {
    throw new PersistenceException(“Entity already exists.”);

    btw, is there a mailing list for kundera? i haven’t seen much activity of late and wondering what the project’s direction is? thx.


    November 11, 2010 at 12:52 pm

    • also, do you have an example of performing an update? the kundera tests that i’ve seen so far only do creates…? thx again.


      November 11, 2010 at 1:06 pm

      • Kundera is JPA compliant. you can use persist/merge methods.


        November 11, 2010 at 7:00 pm

    • This looks nice. Did you try it on? Did that work? We can add this to the code-base.

      Kundera until now has been mainly an internal affair, now that we are seeing some traction and people (like you 🙂 ) are trying their hands. I will create a google group to discuss Kundera stuffs. I will let you know.

      Kundera is fairly active, though little asleep for a while. Everyone seems to be busy in the team. Very soon you are gonna see 0.7 support and all.

      why don’t you join Kundera development?


      November 11, 2010 at 7:05 pm

      • thx animesh.

        i will try to contribute where i can.

        for 0.7 support, are you going to use hector for the internals of kundera? that project looks quite active and riptano, which recently received a lot of funding, is putting their efforts into supporting hector. i don’t see hector as a kundera competitor, but rather kundera as a jpa layer that builds upon hector.

        re entity exists check, i got the following when the tests were run:

        testSaveAuthors(com.impetus.kundera.junit.TestKundera) Time elapsed: 12.446 sec <<< ERROR!
        javax.persistence.PersistenceException: java.lang.IllegalAccessException: Class com.impetus.kundera.ejb.EntityManagerImpl can not access a member of class com.impetus.kundera.entity.Author with modifiers ""
        at com.impetus.kundera.ejb.EntityManagerImpl.persist(
        at com.impetus.kundera.junit.TestKundera.testSaveAuthors(
        Caused by: java.lang.IllegalAccessException: Class com.impetus.kundera.ejb.EntityManagerImpl can not access a member of class com.impetus.kundera.entity.Author with modifiers ""
        at sun.reflect.Reflection.ensureMemberAccess(
        at java.lang.reflect.Field.doSecurityCheck(
        at java.lang.reflect.Field.getFieldAccessor(
        at java.lang.reflect.Field.get(
        at com.impetus.kundera.ejb.EntityManagerImpl.persist(
        … 27 more

        this is the culprit, but not quite sure why:

        Object primaryKey = metadata.getIdProperty().get(e);

        maybe you can provide some insight?

        thx again.


        November 12, 2010 at 12:27 pm

      • got it working. here’s the code:

        // throw EntityExistsException if already exists
        String primaryKey = o.getId();
        Object persistedObj = session.lookup(e.getClass(), primaryKey);
        if (persistedObj != null) {
        throw new PersistenceException(“Entity already exists.”);
        else {
        persistedObj = dataManager.find(e.getClass(), metadata, primaryKey.toString());
        if(persistedObj != null) {
        throw new PersistenceException(“Entity already exists.”);

        i also wrote a unit test to ensure that the exception gets thrown when an attempt is made to persist an entity that has the same id of an entity that has already been persisted:

        * Test that an exception is thrown if an attempt is made to persist
        * a duplicate entity (author).
        * @throws Exception the exception
        public void testSaveDuplicateAuthorThrowsException() throws Exception {
        String key = “author-1”;
        Author animesh = createAuthor(key, “”, “India”, new Date());

        try {
        fail(“An ‘Entity already exists’ exception should have been thrown.”);
        } catch (Exception e) {
        } finally {

        the test executed successfully. can you please review?

        feel free to add the code, or if you add me as a contributor, then i can add the code.



        November 13, 2010 at 1:08 pm

  16. i wrote the implementation for LuceneQuery.getSingleResult(), along with the unit tests, so please let me know how i can check it in?

    also, have you considered moving the project to github?



    November 15, 2010 at 12:36 pm

    • Yep. We are thinking in that direction. Am sure, we will move by the end of this month to github.


      November 15, 2010 at 1:19 pm

      • should i wait until kundera is set up on github, or can i become a contributor now? i have made numerous enhancements that i would like to check-in. do you have a review process for commits? thx.


        November 16, 2010 at 12:24 pm

      • I would appreciate if you can wait for few day, say by next week. Since, we are moving to Github finally, we are not making any check-ins to Google code. Meanwhile, if you can email me your code base… that would be awesome. We can do a peer review here and when we are moved to Github you can push your changes. How does it sound?


        November 16, 2010 at 12:33 pm

      • animesh, what’s your email? thx.


        November 19, 2010 at 10:04 am

  17. animesh,

    i am working through some bugs that i’m encountering with kundera. once they are resolved, i will email you the source for review.

    i did run into a problem where trying to execute the following query (with no ‘where’ clause):

    Query q = secondManager.createQuery(“select a from Author a”);
    List authors = q.getResultList();

    this is throwing an exception. i am investigating, as i want to return back *ALL* records for some queries. have you encountered this?

    also, i haven’t read all the details about lucandra/lucene integration, but would any functionality/performance be lost if only hector were used internally?

    last, any progress on github?

    thx again.


    November 23, 2010 at 12:46 pm

    • Strange! this query had worked for me. Anyways, Hector won’t take away anything from Lucandra. DataManager issues two separate commands, one to CassandraClient (Pelops for now) and another to Lucandra (for indexes, which in turn uses plain thrift client). You can easily replace Pelops with Hector.

      read more on Lucandra here:

      Git should by up any day now.


      November 23, 2010 at 12:52 pm

      • thx animesh.

        re the query problem, yes, you’re right. i just confirmed that it works in QueryTest. my apologies. when i try executing the query:

        select u from User u

        i get the following exception:

        java.lang.RuntimeException: InvalidRequestException(why:start key’s md5 sorts after end key’s md5. this is not allowed; you probably should not specify end key at all, under RandomPartitioner)
        at lucandra.LucandraTermEnum.loadTerms(
        at lucandra.LucandraTermEnum.skipTo(
        at lucandra.IndexReader.docFreq(
        at com.impetus.kundera.query.LuceneQuery.getEntityIdsForQuery(
        at com.impetus.kundera.query.LuceneQuery.getResultList(

        Caused by: InvalidRequestException(why:start key’s md5 sorts after end key’s md5. this is not allowed; you probably should not specify end key at all, under RandomPartitioner)
        at org.apache.cassandra.thrift.Cassandra$
        at org.apache.cassandra.thrift.Cassandra$Client.recv_get_range_slice(
        at org.apache.cassandra.thrift.Cassandra$Client.get_range_slice(
        at lucandra.LucandraTermEnum.loadTerms(
        … 40 more

        have you seen this before?

        besides git, will you also be able to setup discussion forums/mailing lists? i suspect our threads on this blog are not optimal? 🙂

        thx again!


        November 24, 2010 at 12:51 pm

  18. found the problem. i needed to make the following change in cassandra’s storage-conf.xml:


    i saw that the kunera test suite uses OrderPreservingPartitioner. as soon as i changed that in the tests for my project, the aforementioned query worked.

    i need to read up on that setting.



    November 24, 2010 at 1:20 pm

  19. animesh, how would you recommend deploying the persistence tier (using kundera) to an app server (i.e. jboss)? due to all the dependencies that kundera has, would it be best to deploy the persistence tier as an .ear file to app server?



    November 29, 2010 at 1:01 pm

  20. Hi, I’m using JPA query “SELECT a from Author a”. But the query.getResultList() is not returning any resultset. Also, the where clause is not working. Are there any settings to be done to get the resutlset using JPA queries?


    November 30, 2010 at 8:58 pm

    • Looks like without WHERE clause query doesn’t seem to be working.


      December 10, 2010 at 9:22 am

  21. Hi Animesh, how are you doing with the new version of kundera


    December 10, 2010 at 8:20 am

    • Leo, been very busy lately. It might take a week or so before I release a new version.


      December 10, 2010 at 9:21 am

      • wonderful! Is it possible to use native secondary index to do the JPA query rather than lucandra? Cheers!


        December 13, 2010 at 3:37 pm

  22. Hello Animesh,

    I try to run Kundera on my WS (on a JbossAS 5), but it doesn’t work until now.

    I could create an EntityManager. But if I create a Query the Entity is not found.

    EntityManager em = KunderaService.getEntityManager();

    // write a JPA Query
    String jpaQuery = “SELECT r from RecommendationEntity r WHERE SongId = ” + song.getSongId();

    // create Query object
    Query query = em.createQuery(jpaQuery);


    javax.persistence.PersistenceException: No entity found by the name: RecommendationEntity

    I use the



    It seams, that the classloader searches on the wrong Place for the entity-classes … it loads only the jboss-5.1.0.GA\bin\run.jar, but I need the classes from jars in the server/default/deploy directory e.g. from the package “de.testsomething”.

    (the kundera-1.1.1-snapshot.jar and its reverenced jars is in the jboss/common/lib directory)

    If I add the propertie value:
    like you shown it in the persistence.xml for spring, nothing happend.

    If I use a persistence.xml like you use it in your testprojects:


    this error occurs:

    ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] Error installing to Start: name=persistence.uni
    t:unitName=#test-unit-1 state=Create
    java.lang.RuntimeException: Specification violation [EJB3 JPA] – You have not defined a jta-data-source for a JTA enabled persistenc
    e context named: test-unit-1

    Can you give me a hint what I do wrong?

    Thanks in advance.


    December 14, 2010 at 9:03 pm

    • The kundera in the svn trunk only scan the classpath for @entity annotated class. There is a fix which allows kundera to scan web server context


      December 16, 2010 at 5:52 pm

    • thomas/animesh,

      i am getting the same ERROR when i try to deploy my application to jboss-

      java.lang.RuntimeException: Specification violation [EJB3 JPA] – You have not defined a jta-data-source for a JTA enabled persistence context named: abc

      any ideas?

      thx and have a nice wkend!


      December 17, 2010 at 12:37 pm

      • according to the jboss docs:

        “To use EJB3 Entities within JBoss you’ll need to do a few things.

        * Configure a JBoss datasource using *-ds.xml file. Check out the documentation at our wiki or you can view example configurations for many different datasources within: %JBOSS_HOME%/docs/examples/jca

        * Create a persistence.xml file and place it in the META-INF folder of your jar”

        i already created the persistence.xml in the correct location, but if we’re using kundera, what do we need to specify for the datasource (xxx-ds.xml) file in jboss? i’m trying to use kundera as part of an application deployed in an .ear.

        thank you.


        December 18, 2010 at 11:33 am

      • I had the same problem, solved it by simply taking any jta-DS (I took the DefaultDS), so JBoss doesn’t complain anymore.


        May 25, 2011 at 6:16 pm

  23. happy new year everyone.

    is this project still active? i haven’t heard any new developments for a while…?

    thx, and all the best in the new year!


    January 4, 2011 at 11:40 am

    • Hey K,

      Indeed this project is alive. I was hopelessly held up at office. However, I am planning to devote this coming weekend to Kundera.

      My plan of action:

      1. Move to Github (Forking is fun.. no?)
      2. Make Kundera 0.7 compatible. (for schema generation and secondary-indexes support. hopefully this will help Kundera get rid of Lucandra)
      3. Debate on ‘to keep or to remove relationship support’ from Kundera. I strongly think that relationship is corrupting Kundera, and anyhow if you are coming to NoSql world, you should be ready accept few things…and no relation-support is one of them)
      4. Abstract away some part of Kundera, so as to be able to support other NoSql systems in future too, like Riak (that’s my latest crush)
      5. Introduce row locking with Zookeeper.

      Anything else you can think of?



      January 4, 2011 at 11:03 pm

  24. Kundera looks like an awesome project! I sincerely hope more developer will join it… I’d do that myself, but I have only a couple of years of Java experience… I hardly think that’s enough.

    Any chance you provide a tutorial on how Kundera can be used in a Java EE environment?


    January 30, 2011 at 7:14 pm

  25. Hi Animesh,

    I am using cassandra 0.7 and when i tried the sample i am getting the following Exception.

    javax.persistence.PersistenceException: org.apache.thrift.transport.TTransportException: Cannot read. Remote side has closed. Tried to read 4 bytes, but only got 0 bytes.

    This is happening when i try to call the persist on the EntityManager.

    With 0.7 as there is no storage-conf.xml i have used the provided client to create the KeySpace and the Column Family..



    February 6, 2011 at 3:58 am

  26. hi animesh.

    when you deploy kundera using persistence.xml, what do you specify for ?

    jboss is throwing the following, as i do not have specified in persistence.xml.

    java.lang.RuntimeException: Specification violation [EJB3 JPA] – You have not defined a jta-data-source for a JTA enabled persistence context named: abc


    p.s. are you going to setup a google group for kundera? what’s the current status with kundera on github? does it work with cassandra 0.7? is the github code (trunk) for cassandra 0.7, or is it still 0.6 on the trunk? or do you have a branch for the version of kundera that works with 0.6? thx again.


    February 11, 2011 at 12:28 pm

  27. Hi,

    Does the latest version of Kundera supports IN Clause in JPA Query ??

    When i tried the following Query
    String queryStr =”SELECT p from Post p where p.postId IN (?1)”;

    I am getting the Exception

    javax.persistence.PersistenceException: bad jpa query: p.postId IN (?1)
    at com.impetus.kundera.query.KunderaQuery.initFilter(
    at com.impetus.kundera.query.KunderaQuery.postParsingInit(
    at com.impetus.kundera.query.QueryImpl.parse(
    at com.impetus.kundera.query.QueryImpl.(
    at com.impetus.kundera.query.LuceneQuery.(
    at com.impetus.kundera.ejb.EntityManagerImpl.createQuery(

    When i checked the constants defined in i don’t see IN being included in the available list.



    February 22, 2011 at 1:51 am

    • Sateesh, That’s right. Kundera doesn’t implement IN queries. It just supports primitive ones. Let’s try to build advance support in Kundera. what do you say?



      February 22, 2011 at 2:00 am

  28. Hi Animesh!

    I just found your Kundera. It is very interesting for me. Today I’ve checkouted trunk and found that it seems like being unworkable. For example, in EntityManagerImpl in constructor there is no Client reference anymore, and it is commented:
    //this.client = client.
    So for every request to entityManager I have nullPointerException because of nullable client. It is the same for kundera 2.0 branch.
    I’ve found workable version in branch ‘basetrunk’.

    So can you please say what is going with project Kundera? 🙂
    And thank you for such good project. 🙂


    May 16, 2011 at 2:47 am

  29. Hi,
    Instantiation for entityManager is done via Configuration. I recommend to look into TestHBase and TestKundera junits to have a deeper look into this.

    Please refer to given below blog for mongodb stuff:

    This blog also gives an example for creating EntityManager via Configuration object.

    EntityManager is holding up a reference of Client. As IMO holding reference of client with EMF does not make any sense. So EMF is responsible of holding reference of EM(EntityManager).


    Vivek Mishra

    May 17, 2011 at 12:26 pm

  30. I used below code snipplet and it worked:

    Configuration conf = new Configuration();
    EntityManager em = conf.getEntityManager(“your_persistence_unit_name_defined_in_persistence.xml”);

    //access or change data e.g. em.persist();



    May 17, 2011 at 4:21 pm

  31. Hi Animesh,

    Thanks for all your work with this page that have been very helpful to implement Cassandra

    I’m trying to use JPA with a simple query and I’m not being able to do it, do you know how can I get the Entity map to validate that I’m using the correct entity name?

    This is the error I’m getting:

    Kundera Client is: Pelops
    javax.persistence.PersistenceException: No entity found by the name: StoreItemInventory
    at com.impetus.kundera.query.KunderaQuery.initEntityClass(
    at com.impetus.kundera.query.KunderaQuery.postParsingInit(
    at com.impetus.kundera.query.QueryImpl.parse(
    at com.impetus.kundera.query.QueryImpl.(
    at com.impetus.kundera.query.LuceneQuery.(
    at com.impetus.kundera.ejb.EntityManagerImpl.createQuery(


    August 2, 2011 at 2:23 am

  32. Hi Animesh, i am trying to use lucene index. While executing the manager.persist(), method the index_home_dir folder is not creating any files. ie no index being created. i have specified the index_home_dir path in the persistence.xml and also made the partition as OPP. can you help me what could be the reason for this.



    February 13, 2012 at 2:57 pm

  33. I just started looking at Kundera to use in one of my projects. I have used hector earlier. I might have usecases where I need to create secondary indexes, So I had doubt if I need to have lucene for that when using Kundera. I am using datastax enterprise version of cassandra and I have disabled solr and Hadoop


    September 5, 2012 at 5:27 am

  34. Hi, I am planning on using a NOSQL DB for one of our webapps and came across Kundera as a good ORM solution for NOSQL. One my requirements was to add column to a table through the webapp. Is that possible if I use Kundera? I know I can do it directly with any NOSQL with an update statement.


    September 16, 2014 at 1:23 am

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: