Spring data JPA how to get object from 2 tables - sql

I am using Spring Data JPA in project. I have 2 tables in database, and I need to create new object using some data from first table and some data from second one. Anyone have any idea? I can't use #Query in repository because I don't have any entities in code, I have only access to db.

Related

Ontop Plugin in Protege 5.5.0 create graph using database data

I connected the database in protege through Ontop Plugin and created Mapping from Ontop Mappings / Mapping Manager
Now I am creating a graph using that mapping from Ontop Mapping but I m not able to use database table values.
However, I created a database relation mapping graph through OWLViz.
OWLViz
I want to create a graph using table data using multiple inner join queries, but I don't know how to use ontop mapping for the same
SPARQL Query
Have to try to connect your DB with the Ontop plugin in protege?
You have to set Ontop Mapping IDs for creating a graph using SPARQL Query.

Is it necessary for any doctrine mapped table to have an entity with the same name?

Actually I am dealing with a large volume of data in a Symfony 2.8 application and I want to make use of temporary views and tables to cross and query multiple tables with large data. So I am thinking of dynamically creating views, processing these data in the database, querying these views and temporary tables. But symfony generates the error
[Semantical Error] Error: Class not defined.
How to make use of (create and query) temporary tables or views in doctrine / sql?

U-SQL job to query multiple tables with dynamic names

Our challenge is the following one :
in an Azure SQL database, we have multiple tables with the following table names : table_num where num is just an integer. These tables are created dynamically so the number of tables can vary. (from table_1, table_2 to table_N) All tables have the same columns.
As part of a U-SQL script file, we would like to execute the same query on all of these tables and generate an output csv file with the combined results of all these queries.
We tried several things :
U-SQL does not allow looping so we were thinking creating a View in our Azure SQL database that would combine all the tables using a cursor of some sort. Then, the U-SQL file would query this View (using external source). However, a View in Azure SQL database can only be created via a function and a function cannot execute dynamic SQL or even call a stored procedure...
We did not find a way to call a stored procedure of the external data source directly from U-SQL
we dont want to update our U-SQL job each time a new table is added...
Is there a way to do that in U-SQL through a custom extractor for instance? Any other ideas?
One solution I can think of is to use Azure Data Factory (v2) to assist in this.
You could create a pipeline with the following activities:
Lookup activity configured to execute the stored procedure
For Each activity that uses the output of the lookup activity as a source
As a child item use a U-Sql Activity that executes your U-Sql script which writes the output of a single table (the item of the For Each activity) to blob or datalake
Add a Copy Activity that merges the blobs from step 2.1 to one final blob.
If you have little or no experience working with ADF v2 do mind that it takes some time to get to know it but once you do, you won't regret it. Having a GUI to create the pipeline is a nice bonus.
Edit: as #wBob mentions another (far easier) solution is to somehow create a single table with all rows since all dynamically generated table have the same schema. You can create a stored procedure for populating this table for example.

Not getting the column access in Ignite Cache created and loaded from Oracle

I am doing a POC to ingest data from Oracle to Ignite cluster and Fetch the
data from Ignite in another application. When I created the Model and Cache,
I specified the Key as String and value as Custom Object. Data loaded to
cluster but then I querying "SELECT * FROM TB_USER" I am getting only two
column, i.e. _KEY and _VAL. I am trying to get all the column from the
TB_USER. What are the configuration required for this?
There are three ways of configuring SQL tables in Ignite:
DDL statements (create table). As far as I can see, you used something else.
QueryEntities. You should enlist all columns that you want to see in your table in the QueryEntity#fields property. All names should correspond to field names of your Java objects.
Annotations. Fields, that are annotated as #QuerySqlField will become columns in your table.

How to use stored procedures in NHibernate for Create/Update when working with database view

I have a SQL Server view CyclesList on the table Cycle. Cycle table contains a few columns, and CyclesList view add some more data that can be computed on database level.
And now, I have a NHibernate mapping that points to CyclesList:
<class name="Cycle" table="CyclesList">
However, I would still like to work with Cycle class, and perform Create/Update operations , but I have to use stored procedure that will access Cycle table directly. Is there a way to achieve it in NHibernate? I would appriciate a sample mapping/links to resources with samples. Thanks
You find some information in the docs under "Native-Sql -> Custom SQL for create, update and delete". Basically, you need the "sql-insert", "sql-delete" and "sql-update" elements in the mapping file.
There is also an example on Ayendes blog.