As per the Spring-data-cassandra docs,
http://docs.spring.io/spring-data/cassandra/docs/1.1.1.RELEASE/reference/html/#requirements
Paging and Sorting queries are supported, however, when I use Interface PagingAndSortingRepository, paginated queries throws following exception:
Below is my interface definition:
#EnableCassandraRepositories
public interface PersonRepository extends PagingAndSortingRepository<User, String>
.
.
.
Below is stack trace:
Caused by: org.springframework.dao.InvalidDataAccessApiUsageException: neither slice nor page queries are supported yet
at org.springframework.data.cassandra.repository.query.CassandraQueryMethod.verify(CassandraQueryMethod.java:80)
at org.springframework.data.cassandra.repository.query.CassandraQueryMethod.<init>(CassandraQueryMethod.java:68)
at org.springframework.data.cassandra.repository.support.CassandraRepositoryFactory$CassandraQueryLookupStrategy.resolveQuery(CassandraRepositoryFactory.java:106)
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.<init>(RepositoryFactorySupport.java:357)
at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:192)
at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.initAndReturn(RepositoryFactoryBeanSupport.java:239)
at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:225)
at org.springframework.data.cassandra.repository.support.CassandraRepositoryFactoryBean.afterPropertiesSet(CassandraRepositoryFactoryBean.java:62)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1613)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1550)
... 11 more
Please help !!!
This is a documentation copy/paste error. Please enter a JIRA issue for the incorrect documentation. There is already an issue tracking whether paging & sorting can be supported at https://jira.spring.io/browse/DATACASS-56
Related
I am using spring data couchbase and I want to write a custom query for deleting all the docs based on some condition
I have below query written down:
#Query("#{#n1ql.delete} WHERE #{#n1ql.filter} AND " +
"accountId = $1 #{#n1ql.returning}")
Mono<Void> delete(String accountId);
But this does not seem to be working. Please help me to fix this issue.
What version are you using?
Please show the calling code and how you determine it does not work.
Two things to check-
If the document to be deleted was just inserted, it may not yet have been indexed.
This is a reactive repository - tbe n1ql wiil not be executed unless the result is collected.
I'm trying to use the new ChangeStream feature with Mongo Java Driver 3.6, but I'm stuck. This is my error:
ChangeStreamDocument contains generic types that have not been specialised.
Top level classes with generic types are not supported by the PojoCodec.
Here's how I'm starting the changeStream:
CodecRegistry pojoCodecRegistry = fromRegistries(MongoClient.getDefaultCodecRegistry(),
fromProviders(PojoCodecProvider.builder().automatic(true).build()));
MongoDatabase database = mongoClient.getDatabase(mongoClientURI.getDatabase())
.withCodecRegistry(pojoCodecRegistry);
collection.insertOne(Person.builder().age(100).build());
collection.insertOne(Person.builder().age(100).build());
collection.watch().forEach((Block<? super ChangeStreamDocument<Person>>) personChangeStreamDocument -> {
System.out.println(personChangeStreamDocument.getFullDocument());
});
Person is just a POJO.
There's currently a bug with the automatic ProjoCodecProvider as described in JAVA-2800.
The temporary workaround is register the POJO classes manually for example:
CodecRegistry pojoCodecRegistry = fromRegistries(MongoClient.getDefaultCodecRegistry(),
fromProviders(PojoCodecProvider.builder().register(Person.class).build()));
Additionally, please note that you may not be able to see the event insert if you performed the insert operation before you open a change stream on a collection. Although you can test this easily by inserting/altering documents from another thread or process. See also Change Streams for more information.
UPDATE: The ticket JAVA-2800 has been resolved and a fix version is available on MongoDB Java Driver v3.6.4+.
I'm trying to use a custom DbExecutionStrategy that implements retries, but I'm getting the following error:
An exception of type 'System.InvalidOperationException' occurred in EntityFramework.dll but was not handled in user code
Additional information: Streaming queries are not supported by the configured execution strategy 'MyDbExecutionStrategy'. See http://go.microsoft.com/fwlink/?LinkId=309381 for additional information.
If you follow that link it will explain that EF6 doesn't use streaming by default but that you can turn it on by using AsStreaming().
By default, EF6 and later version will buffer query results rather than streaming them. If you want to have results streamed you can use the AsStreaming method to change a LINQ to Entities query to streaming.
However, the call that is being made does not use streaming and I don't have any code that calls AsStreaming().
dataModel.Set<DeploymentLog>().OrderByDescending(d => d.DeploymentTimestamp).FirstOrDefault()
I've copied the code and the strategy to a different command line app that I created to test it and it works fine there. But in my web application I'm getting that error.
Any ideas why? Is there some kind of setting to turn on streaming on all queries?
I am working on an application with ASP.Net/MVC/EF/Breeze/Angular and it is working in my development environment. I just deployed it to my test environment and I am getting an error when I try to query breeze entity data. I don't think it's a DB connection problem, because I can query the breeze metadata successfully.
However, when I try to query for entity data, for example:
http://server/path/breeze/data/Cities
I get the following error:
{"$id":"1","$type":"System.Web.Http.HttpError, System.Web.Http","Message":"An error has occurred."}
This shows up as a 500 error in the browser network history. Is there any way to get Breeze to return a more detailed error message? I am not getting this error in development so I can't debug it there. Or any suggestions as to what I should look for if I can get metadata but not data?
Well, it turns out it was a connection string problem! I have no idea how breeze was generating metadata without a DB connection. Maybe it caches it in a local file?
Anyways, it would be nice to be able to get more detailed messages in cases like this. Since breeze returns IQueryable<T> I couldn't see any obvious way to catch the exception and send back a message myself...
we have a table called job which has a self referencing key. We are using JPA and eclipselink as the JPA provider. Sometimes we are getting the following exception
Exception [EclipseLink-4002] (Eclipse Persistence Services -
2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DatabaseException Internal
Exception: com.sybase.jdbc3.jdbc.SybSQLException: Your server command
(family id #0, process id #384) encountered a deadlock situation.
Please re-run your command.
We have an action in our UI which when performed a JSM message will go to some external component and a record will be created in our job table and then the job id will be sent to client and he will be redirected to the jobs view which lists all jobs in the table. After he is redirected the client will send an ajax request to list all jobs. While this operation is going we will receive notifications from external components and then we update the jobs table records.
I strongly believe that while the select operation is going we are trying to update the table and this is happening. Can anyone please tell me how to solve this problem.
Thank you all in advance good day.
You may be able to get around the select/update conflict by changing the locking scheme for the table, in addition to having good indexes.
Sybase has good documentation on this here:
Performance and Tuning Series: Locking and Concurrency Control