Comments (9)
Matthew T. Adams commented
This includes both @Query
annotation support and dynamic query methods on repository subinterfaces
from spring-data-cassandra.
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.
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.
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.
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.
Colin McQueen commented
Ok, thanks. :)
from spring-data-cassandra.
Matthew T. Adams commented
Created DATACASS-107 for work
from spring-data-cassandra.
Mark Paluch commented
Renaming this ticket as @Query
annotated methods are already in place
from spring-data-cassandra.
John Blum commented
Reviewed and merged PR #74 to master
for the Ingalls, 1.5 M1
release
from spring-data-cassandra.
Related Issues (20)
- Add support for ValueExpression
- Release 4.1.10 (2023.0.10)
- Release 4.2.4 (2023.1.4)
- Release 4.3 M2 (2024.0.0)
- How do I add converter from Instant to org.joda.time.DateTime to spring-data-commons-3.2.1 and spring-data-cassandra-4.2.1 HOT 8
- Release 4.1.11 (2023.0.11)
- Release 4.2.5 (2023.1.5)
- Release 4.3 RC1 (2024.0.0)
- Crac Support - Lifecycle Implementation HOT 1
- Release 4.1.12 (2023.0.12)
- Release 4.2.6 (2023.1.6)
- Release 4.3 GA (2024.0.0)
- Allow configuration of `CassandraObservationConvention` HOT 5
- Release 4.2.7 (2023.1.7)
- Release 4.3.1 (2024.0.1)
- Release 4.4 M1 (2024.1.0)
- Assertion does not match its error message and comments for `QueryOptions.readTimeout` method HOT 1
- Release 4.2.8 (2023.1.8)
- Release 4.3.2 (2024.0.2)
- Switch to Broadcom docker proxy
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spring-data-cassandra.