How to find the database exist or not with Jaydata Context - jaydata

I am working on an application with jaydata as ORM and angularjs as middle layer : working with jaydata how can i find with context that whether the DB has already benn created or its the first time it is been created by the code ..>???

You can perform this check only if you verify the number of the records in a specific table that normaly contains data.

Related

Unable to find other entity-type in Apache Atlas . Only Showing hdfs_path

Hi I am new to Apache Atlas . And I am facing a problem.
I want to create a hive_table entity type manually but in Entity type drop downs its showing only "hdfs_path"
Can anyone let me know how I can use a custom entity type in apache Atlas.
And can anyone provide me a good documentation part or tutorial apart form Apche Atlas site.
Here is the photo where I want to add a new entity type
TL;DR: you need to apply the following setting to atlas-application.properties, and restart:
atlas.ui.editable.entity.types=<your entity types>
Note that <your entity types> can be a comma-separated list, like hdfs_path,kafka_topic or, to just allow all Types to be created and edited via the UI, use a star *.
I guess the reason for this restrictive default is because metadata in Atlas is normally synchronised from other systems using hooks and bridges. So in order to keep the metadata "consistent" (i.e. prevent the risk of people creating metadata entries in Atlas which do not correspond to actual data assets existing in the referenced systems), by default editing Entity Types via the UI is locked down.
Reference: https://issues.apache.org/jira/browse/ATLAS-3237
hive_table entity should be synced using import scripts.
"hdfs_path" is not synced automatically unless they belong to lineage, hence the option to create them manually.
However, if you want to create them manually, please check the following link, which has the steps:-
https://community.cloudera.com/t5/Support-Questions/How-to-create-hive-table-entity-in-Apache-atlas-using-REST/td-p/173644

CRUD operation Grails

I need to read data from existing database is it possible using
compile "org.grails.plugins:db-reverse-engineer:4.0.0"?
My operations are: user should read data from existing table, create new record, create new coulmn, edit coulmn name, edit records.
View format will be in grid like xml grid.
Which technology is the best for these operations in grails, I have plan to work on javascript using jaxrs, is it good to do?
DB Reverse Engineering Plugin (org.grails.plugins:db-reverse-engineer:4.0.0) allows you to generate domain classes using existing DB. After you generate them - just use GORM to perform CRUD operations. You can read about GORM here
You can implement REST api in Grails using standart ways, check this answer to get high level understanding. If you need jaxrs- there is a plugin for that.

Yii2- Failed to create Mongodb models using Gii

I can't create MongoDb models using Gii module code generator. Gets the below error :
Unknown Method – yii\base\UnknownMethodException
Calling unknown method: common\components\MongoConnection::getTableSchema()
Gii should not be used to create MongoDB Models.
MongoDB documents may change from one to another and there is no "collection definiton", as oposed to "table schemas" where you can get all column names and types.
This is the reason why a model cannot be created automatically and should be created manually.
There is a Gii component to help you generate MongoDB ActiveRecords.
Here's a little YouTube video that shows you exactly how it modify Yii2 configuration, create an active record and generate a CRUD controller.
http://www.youtube.com/watch?v=1urmws7hz5Q

Where do you create a custom model (DTO) in server code, such that Breeze can relate to EntityFramework entities?

I am developing a SPA using Angular-Breeze-WebAPI-EntityFramework.
Now Breeze uses the Entity Framework metadata information to create it's own Breeze models. We use this in our application for Breeze validation.
So far, it's all been nice and easy. Now we are having to create a search page (say for querying customers). The search can be by Customer.Name or by Product.Id (which would return a list of customers who have bought that product). The result is a ng-repeater, which displays Customer.Name, Order.LastPlaced etc.
if you are getting confused by the tables and columns, forget that. What I am only trying to get to is that, both the search object and the result object are not 1:1 with Entity tables (or objects). So obviously I feel the need to create a custom object (one for the search and one for the results). My question primarily is where and how do I create that object?
If I create it at the data layer, Breeze would have no idea of the metadata for each of the properties (since it uses EF for that).
I obviously can't create just a JavaScript object, since I will have to query the database (using EF) to search and populate the object.
So where does one create such a custom object (traversing multiple tables) such that Breeze still can figure out the metadata and perform validation and such when the need arises?
Thank you all.
You can create metadata on the client for types that the server either doesn't know about or doesn't have the schema for. See http://www.breezejs.com/documentation/metadata-by-hand.

How to create some test data using Entity Framework

I'm using EF 4 and MVC in C#,
When my application loads, I would like load create some entities to be added to my database, so where is the best place to add thsi functionality using EF? Global.asax on Start application?
What is a reasonable name convention for the class... BootStrap?
Thanks
If you have existing database you should not include the initialization into your application. The only way how to make this work in existing database is to execute some initialization in Application_Start. The initialization must check existence of every entity you want to insert and insert data only if the entity is not present. Because your database already exists, the initialization logic will have to run every time you restart the application. To avoid this you would also need some flag in the database to mark that initialization was already done (one of inserted entity can be considered as a "flag" but only if the application cannot remove this entity).
EF normally seeds data only when creating database or after database migration.
Edit: If you are creating test data on your test database you should be happy with database recreation each time your model changes (or with migrations) and custom database initializer to seed your data.