Like we use #Query for sql driver, or jpa, what is the alternative annotation for azure cosmosDB(DocumentDb) to use in the java class?
enter image description here
As i searched for spring-data-cosmosdb source code, it does not support #Query annotation. Please refer to below cases:
1.Is there any way to write custom or native queries in Java JPA (DocumentDbRepository) while firing a query to azure-cosmosdb?
2.#Query doesn't work in Spring Boot (JPA ) + Azure Cosmos db
Besides,you could ask the support of this feature in this feedback or contact with azure cosmos db team directly there.
The updated version
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-spring-data-cosmos-core</artifactId>
<version>3.0.0-beta.1</version>
</dependency>
which was released in August 2020 does support #Query.
You can find the documentation over here.
Related
I am using following dependency for connecting with azure cosmos db
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-documentdb</artifactId>
<version>LATEST</version>
</dependency>
And using this query
"SELECT c.parentid, COUNT(1) AS count FROM collection c WHERE c.parentid != 'null' GROUP BY c.parentid"
And I am getting following error -
{"errors":[{"severity":"Error","location":{"start":91,"end":96},"code":"SC1001","message":"Syntax error, incorrect syntax near 'GROUP'."}
Is there any configuration I am missing in Java application or is group by not supported?
The problem is that you are using an old version of the Java SDK that does not have support for GROUP BY.
Please upgrade to the latest Java SDK v4. The dependency section should look like this.
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-cosmos</artifactId>
<version>4.8.0</version>
</dependency>
If you are new to using the v4 Java SDK it has both sync and async modules included. You can take a look by following this here, Quickstart: Build a Java app to manage Azure Cosmos DB SQL API data
I am trying to migrate an AppEngine project to MVM, custom runtime environment.
I faced an issue with Memcache, which was solved by replacing:
CacheManager.getInstance().getCacheFactory().createCache ...
...
with:
new XMemcachedClient(
System.getenv.get("MEMCACHE_PORT_11211_TCP_ADDR"),
Integer.parseInt(System.getenv.get("MEMCACHE_PORT_11211_TCP_PORT")))
...
(BTW, if anyone is having same issues, then maven for XMemcached is:)
<dependency>
<groupId>com.googlecode.xmemcached</groupId>
<artifactId>xmemcached</artifactId>
<version>2.0.0</version>
</dependency>
I am now facing an issue with DataStore JDO and PersistenceManager (using DataNucleus in the project).
Basically, I am looking to replace this:
JDOHelper.getPersistenceManagerFactory("xxx").getPersistenceManager() ...
...
with ?...
Are there any "magic" environment variables I can use for composing the address (like the MEMCACHE_PORT_11211_TCP_ADDR and MEMCACHE_PORT_11211_TCP_PORT is the case of Memcache)? Any other means I can communicate the datasource with (from a MVM project)?
Thanks in advance,
Ohad
You may want to consider using the gcloud-java project for accessing datastore. The big advantage here is that you can use the same code/client from App Engine, Container Engine, and Compute Engine:
https://github.com/GoogleCloudPlatform/gcloud-java
Hope this helps!
I wanted to know if I can use Symphony 2 and Cassandra Database for a web project.
I know that Symphony 2 supports NoSQL databases like MongoDB, but I am not sure if it do the same with Cassandra.
Any clarification would be welcome.
Natively - no, but you could use PHP client for Cassandra, for example https://github.com/thobbs/phpcassa or even Symfony2 Bundle which just wrap up the phpcassa - https://github.com/amigos-del-rigor/ADRCassandraBundle.
You can this bundle https://github.com/M6Web/CassandraBundle build on top of the official driver from datastax
works fine whith php 5.6 or php7
Is there a way to perform database schema generation with the Simple.Data library (similar to how Fluent NHibernate does it)?
If not, is there a way to run DDL (Data Definition Language) commands against a database via the Simple.Data library?
Currently in some integration tests I am creating a SQL CE database on the fly, auto generating the schema (via Fluent NHibernate), running the tests (accessing the database via Simple.Data), then deleting the database after the tests run (for cleanup).
It would be nice to be able to perform the DDL stuff using Simple.Data and remove the Fluent NHibernate dependency.
I recommend using Fluent Migrator for building DB schema (https://github.com/schambers/fluentmigrator/). It's what Simple.Data migrations would probably look like, so there seems little point reinventing the wheel.
Simple.Data 0.10 will have a new InMemory adapter which is schema-less, to reduce testing friction. Will be out by the end of November.
I am currently using SubSonic (2.2 and 3) for some ASP.NET projects and have managed to get them working with SQL Server (using ActiveRecord). However, I also want to know how to set it up with other (open source) databases, e.g. PostgreSQL and SQLite. This is so I can use it on a web host without SQL Server on. The providers I have found are:
PostgreSQL: Npgsql
SQLite: System.Data.SQLite or Mono.Data.SqliteClient (if it works with Microsoft.NET)
Anyone have any experience with SubSonic know how to do this (some sample demo would be good - just a basic primer on querying would be fine)? Non-ASP.NET MVC though (not got into it yet). I have only basic knowledge of SQLite (basically using SQLite Manager in Firefox and querying it via PHP Data Objects) and have not used Postgresql, but assume it would be more scalable than SQLite.
For version 3
PostgreSQL: There aren't any templates for postgres at the moment so you'd need to create the templates yourself
SQLite - The steps should be as follows:
Add a reference to System.Data.SQLite
Look in the TemplateProviders folder you'll find a SQLite.ttinclude which you'll need to drop into your project instead of SQLServer.ttinclude.
Change the .tt files that reference SQLServer.ttinclude to reference SQLite.ttinclude instead.
This is so I can use it on a web host without SQL Server on.
With the release of SQLExpress dont all hosts offer this? (I only use dedicated server so I have no direct experiance with this)
In response to your question.
SQLite - http://codefornothing.wordpress.com/2007/07/19/sqlite-data-provider-for-subsonic-part-2/
Postgre: Doesnt look as simple,
Subsonic postgreSQL Template
PostgreSQL via subsonic
Good luck.
In short, Subsonic only support few database only NOT ALL ( that what their claimed :( ). Try nHibernate, support most of the database.