Giter VIP home page Giter VIP logo

Comments (9)

spring-projects-issues avatar spring-projects-issues commented on May 2, 2024

Matthew T. Adams commented

This includes both @Query annotation support and dynamic query methods on repository subinterfaces

from spring-data-cassandra.

spring-projects-issues avatar spring-projects-issues commented on May 2, 2024

Colin McQueen commented

The company I work for follows this pattern with repositories having declarative query methods and would like to have this implemented. Is this task being worked on?

from spring-data-cassandra.

spring-projects-issues avatar spring-projects-issues commented on May 2, 2024

Matthew T. Adams commented

We hope to implement this feature as part of the 1.0 release, but have not yet committed to it. In its absence, the intended workaround is to use static queries via the @Query annotation

from spring-data-cassandra.

spring-projects-issues avatar spring-projects-issues commented on May 2, 2024

Colin McQueen commented

Oh, I interpreted this task differently. I thought that I couldn't use the @Query annotation at all in the Cassandra Repository. I tried using the annotation but it failed with the following stacktrace:

java.lang.IllegalStateException: You have defined query method in the repository but you don't have no query lookup strategy defined. The infrastructure apparently does not support query methods!
	at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.<init>(RepositoryFactorySupport.java:295)
	at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:161)
	at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:162)
	at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:44)
	at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:142)
	... 57 more

Here's what I have for my configuration:

import org.springframework.context.annotation.Configuration;
import org.springframework.data.cassandra.config.java.AbstractSpringDataCassandraConfiguration;
import org.springframework.data.cassandra.repository.config.EnableCassandraRepositories;
import org.springframework.data.repository.query.QueryLookupStrategy;

@Configuration
@EnableCassandraRepositories(basePackages = "com.foo.repository",
        queryLookupStrategy = QueryLookupStrategy.Key.CREATE_IF_NOT_FOUND)
public class CassandraConfiguration extends AbstractSpringDataCassandraConfiguration {

    @Override
    protected String getKeyspaceName() {
        return "foo";
    }
}

Here's an example of my repository:

import com.foo.Foo;
import com.foo.Foo.FooKey;
import java.util.List;
import org.springframework.data.cassandra.repository.CassandraRepository;
import org.springframework.data.cassandra.repository.Query;
import org.springframework.stereotype.Repository;

@Repository
public interface IFooRepository extends CassandraRepository<Foo, FooKey> {
    
    @Query("SELECT * FROM foo")
    List<Foo> getAllFoo();
}

from spring-data-cassandra.

spring-projects-issues avatar spring-projects-issues commented on May 2, 2024

Matthew T. Adams commented

Yes, using @Query is the intended workaround. We just haven't implemented it yet. :)

I'll see if I can bump the priority on this one

from spring-data-cassandra.

spring-projects-issues avatar spring-projects-issues commented on May 2, 2024

Colin McQueen commented

Ok, thanks. :)

from spring-data-cassandra.

spring-projects-issues avatar spring-projects-issues commented on May 2, 2024

Matthew T. Adams commented

Created DATACASS-107 for work

from spring-data-cassandra.

spring-projects-issues avatar spring-projects-issues commented on May 2, 2024

Mark Paluch commented

Renaming this ticket as @Query annotated methods are already in place

from spring-data-cassandra.

spring-projects-issues avatar spring-projects-issues commented on May 2, 2024

John Blum commented

Reviewed and merged PR #74 to master for the Ingalls, 1.5 M1 release

from spring-data-cassandra.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.