Corda VaultQuery on Column with Join - corda

Can vault query work with fields that are associated with column that contain List and annotated with ElementCollection and CollectionTable ?

Yes, Here is the page for how to make Vault Query in Corda: https://docs.corda.net/api-vault-query.html

Related

DynamoDB sub item filter using .Net Core API

First of all, I have table structure like this,
Users:{
UserId
Name
Email
SubTable1:[{
Column-111
Column-112
},
{
Column-121
Column-122
}]
SubTable2:[{
Column-211
Column-212
},
{
Column-221
Column-222
}]
}
As I am new to DynamoDB, so I have couple of questions regarding this as follows:
1. Can I create structure like this?
2. Can we set primary key for subtables?
3. Luckily, I found DynamoDB helper class to do some operations into my DB.
https://www.gopiportal.in/2018/12/aws-dynamodb-helper-class-c-and-net-core.html
But, don't know how to fetch only perticular subtable
4. Can we fetch only specific columns from my main table? Also need suggestion for subtables
Note: I am using .net core c# language to communicate with DynamoDB.
Can I create structure like this?
Yes
Can we set primary key for subtables?
No, hash key can be set on top level scalar attributes only (String, Number etc.)
Luckily, I found DynamoDB helper class to do some operations into my DB.
https://www.gopiportal.in/2018/12/aws-dynamodb-helper-class-c-and-net-core.html
But, don't know how to fetch only perticular subtable
When you say subtables, I assume that you are referring to Array datatype in the above sample table. In order to fetch the data from DynamoDB table, you need hash key to use Query API. If you don't have hash key, you can use Scan API which scans the entire table. The Scan API is a costly operation.
GSI (Global Secondary Index) can be created to avoid scan operation. However, it can be created on scalar attributes only. GSI can't be created on Array attribute.
Other option is to redesign the table accordingly to match your Query Access Pattern.
Can we fetch only specific columns from my main table? Also need suggestion for subtables
Yes, you can fetch specific columns using ProjectionExpression. This way you get only the required attributes in the result set

How do I query for Distinct Records using Query Criteria on a Queryable State

I've a query-able state and I want do a SQL query like :
SELECT DISTINCT column1,column2,.. FROM table_name;
How can I do that using Vault Query and Vault Custom Query Criteria.
Even if I get the whole state which has these distinct columns, I'm fine.
As of Corda 3, there is no way to do this using VaultQuery/VaultCustomQueryCriteria. You need to connect directly to the node's database via JDBC.

Dynamodb hashkey rangekey query with additional filters (java sdk)

We are using java AWS sdk (1.10.10) to connect to dynamoDB instance and we have a hashkey-rangekey load query which returns us the data we need.
The query uses the sdk's DynamoDBMapper to get data as follows :
mapper.load(clazz, hashKey, rangeKey, config)
Now we have a have a requirement to add an additional filter on a column which is neither the hashkey or rangekey
What is the best way to do this ?
You can use query api to add additional filter attributes (non key attributes). The additional attributes should be given on FilterExpression parameter.

Joins in datastore

How to implement joins in datastore ,iam using java ,i want to insert a file(Excel,img,word or pdf) into datastore and retrive a file from datastore.
Joins are not supported in GAE. See this documentation:
http://code.google.com/appengine/docs/java/datastore/jdo/relationships.html
If you are looking for an RDBMS style database in GAE, then Google Cloud SQL would be your choice: http://code.google.com/apis/sql/docs/developers_guide_java.html
Joins are not supported in GAE datastore, but you can use the latest service-CloudSQL
https://cloud.google.com/products/cloud-sql
See this documentation:
https://developers.google.com/cloud-sql/docs/introduction
you can't do joins in the datastore, a better option would be to filter entries as you go along. e.g., you want to join student entity with classes entity. You can't write a simple select s.student, c.class from student s join class c on s.class_id = c.class_id where...
instead, do a filter on student first, get a set of those values ('foreign key') in a buffer and then use that buffer to filter on the other table, class

Linq query returning Less records than Sql Query

I am facing a big problem with simple linq query.. I am using EF 4.0..
I am trying to take all the records from a table using a linq query:
var result = context.tablename.select(x=>x);
This results in less rows than the normal sql query which is select * from tablename;
This table has more than 5 tables as child objects (foreign key relations: one to one and one to many etc)..
This result variable after executing that linq statement returns records with all child object values without doing a include statement..
I don't know is it a default behavior of EF 4.0 ..
I tried this statement in linqpad also..but there is no use...
But interesting thing is if I do a join on the same table with another one table is working same is sql inner join and count is same..but I don't know why is it acting differently with that table only..
Is it doing inner joins with all child tables before returning the all records of that parent table??
please help me..
This table has more than 5 tables as
child objects (foreign key relations:
one to one and one to many etc)..
This result variable after executing
that linq statement returns records
with all child object values without
doing a include statement..
So we are probably talking about database view or custom DefiningQuery in SSDL.
I described the same behavior here. Your entity based on joined tables probably doesn't have unique identification for each retruned row so your problem is Identity map. You must manually configure entity key of your entity. It should be composite key based on all primary keys from joined tables. Entity key is used to identify entity in indenty map. If you don't have unique key for each record only first record with the new key is used. If you didn't specify the key manually EF had infered its own.
The easiest way to troubleshoot these types of issues is to look at the generated SQL produced by the ORM tool.
If you are using SQL Server then using the SQL Profiler to view the generated SQL.
From what you are describing, a possible explanation might be that your relationships between entities are mandatory and thereby enforcing INNER joins instead of LEFT OUTER joins.

Resources