Skip to content

kundera-cassandra JPA 2.1 using clause LIK and IN #648

Description

@gbmamat

Dear,

I work with kundera-cassandra 2.13, cassandra-2.0.10, lucene 4.10.1, Spring 3.2.6, Java SDK 7.

I want implement search component: following my configuration files:

Kundera-cassandra.xml



cassandra







taskfeeds@cassandra_pu











Persistence.xml



com.impetus.kundera.KunderaPersistence
..........
com.taskfeeds.models.UserProfile

    <exclude-unlisted-classes>true</exclude-unlisted-classes>
    <properties>
        <property name="kundera.nodes" value="localhost" />
        <property name="kundera.port" value="9160" />
        <property name="kundera.keyspace" value="taskfeeds" />
        <property name="kundera.dialect" value="cassandra" />
        <property name="kundera.ddl.auto.prepare" value="update" />
        <property name="kundera.client" value="thrift" />
        <property name="kundera.client.lookup.class"            value="com.impetus.client.cassandra.thrift.ThriftClientFactory" />
        <property name="kundera.client.property" value="./kundera-cassandra.xml" />
        <property name="index.home.dir" value="E:/dev/lucene-4.10.1" />

    </properties>
</persistence-unit>

Entity:

@entity
@table(name="USER_PROFILE",schema="taskfeeds@cassandra_pu")
@IndexCollection(columns = { @Index(name = "lastName"), @Index(name = "firstName"),@Index(name = "email"),@Index(name = "phone")})
public class UserProfile implements Serializable {

/**
 * 
 */
private static final long serialVersionUID = -8855320102379946990L;

@Id
@Column(name = "user_profile_id")
private String userProfileId;

@Column(name = "first_name")
private String firstName;

when I use following code:

                       String queryString="select u from UserProfile u where u.firstName LIKE 'Ghis";

               int count=dao.findByQuery(queryString).size();

            System.out.println("Size:"+count);

2014-10-14 03:18:50,121+0200 | DEBUG [main] AnnotationTransactionAttributeSource.getTransactionAttribute(106) | Adding transactional method 'findByQuery' with attribute: PROPAGATION_REQUIRED,ISOLATION_DEFAULT; ''
2014-10-14 03:18:50,121+0200 | DEBUG [main] DefaultListableBeanFactory.doGetBean(242) | Returning cached instance of singleton bean 'transactionManager'
2014-10-14 03:18:50,131+0200 | DEBUG [main] JpaTransactionManager.getTransaction(365) | Creating new transaction with name [com.taskfeeds.dao.TaskfeedsDaoImpl.findByQuery]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT; ''
2014-10-14 03:18:50,131+0200 | DEBUG [main] EntityManagerImpl.(129) | Creating EntityManager for persistence unit : cassandra_pu
2014-10-14 03:18:50,131+0200 | DEBUG [main] EntityManagerImpl.(129) | Creating EntityManager for persistence unit : cassandra_pu
2014-10-14 03:18:50,131+0200 | INFO [main] EntityManagerImpl.discoverClient(983) | Returning client instance for persistence unit cassandra_pu.
2014-10-14 03:18:50,131+0200 | INFO [main] EntityManagerImpl.discoverClient(983) | Returning client instance for persistence unit cassandra_pu.
2014-10-14 03:18:50,131+0200 | DEBUG [main] GenericClientFactory.getClientInstance(243) | Returning fresh client instance for persistence unit : cassandra_pu
2014-10-14 03:18:50,131+0200 | DEBUG [main] EntityManagerImpl.(147) | Created EntityManager for persistence unit : cassandra_pu
2014-10-14 03:18:50,131+0200 | DEBUG [main] EntityManagerImpl.(147) | Created EntityManager for persistence unit : cassandra_pu
2014-10-14 03:18:50,131+0200 | DEBUG [main] JpaTransactionManager.doBegin(323) | Opened new EntityManager [com.impetus.kundera.persistence.EntityManagerImpl@cc684b] for JPA transaction
2014-10-14 03:18:50,131+0200 | INFO [main] TaskfeedsDaoImpl.findByQuery(71) | select u from UserProfile u where u.firstName LIKE 'Ghis
2014-10-14 03:18:50,131+0200 | DEBUG [main] ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.enlistInCurrentTransaction(423) | Starting resource local transaction on application-managed EntityManager [com.impetus.kundera.persistence.EntityManagerImpl@1344746]
2014-10-14 03:18:50,131+0200 | DEBUG [main] ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.doJoinTransaction(400) | Joined local transaction
2014-10-14 03:18:50,141+0200 | INFO [main] QueryImpl.getResultList(148) | On getResultList() executing query: select u from UserProfile u where u.firstName LIKE 'Ghis
2014-10-14 03:18:50,141+0200 | WARN [main] CassandraClientBase.isCql3Enabled(752) | Super Columns not supported by cql, Any operation on supercolumn family will be executed using thrift, returning false.
2014-10-14 03:18:50,141+0200 | INFO [main] CassandraEntityReader.populateRelation(108) | On populate relation via JPQL
2014-10-14 03:18:50,171+0200 | DEBUG [main] LuceneIndexer.search(382) | Searching index with query[UserProfile.first_name:*Ghis AND entity.class:com.taskfeeds.models.userprofile], start:-1 , count:100
2014-10-14 03:18:50,201+0200 | DEBUG [main] JpaTransactionManager.processCommit(752) | Initiating transaction commit
2014-10-14 03:18:50,201+0200 | DEBUG [main] JpaTransactionManager.doCommit(462) | Committing JPA transaction on EntityManager [com.impetus.kundera.persistence.EntityManagerImpl@cc684b]
2014-10-14 03:18:50,201+0200 | DEBUG [main] JpaTransactionManager.doCleanupAfterCompletion(548) | Closing JPA EntityManager [com.impetus.kundera.persistence.EntityManagerImpl@cc684b] after transaction
2014-10-14 03:18:50,201+0200 | DEBUG [main] EntityManagerFactoryUtils.closeEntityManager(328) | Closing JPA EntityManager
2014-10-14 03:18:50,201+0200 | DEBUG [main] PersistenceDelegator.flush(372) | Flushing following flush stack to database(s) (showing stack objects from top to bottom):
[]
2014-10-14 03:18:50,201+0200 | DEBUG [main] PersistenceDelegator.flush(372) | Flushing following flush stack to database(s) (showing stack objects from top to bottom):

I get Size: 0, so that, I've 10 datas on Cassandra!

Can you help me please?

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions