CRUD operation Grails - rest

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.

Related

multi-tenancy with sequelize and nest.js

I want to implement a multi-tenant solution where I have one webserver and one database shared across all tenants. Regarding to this blog post from AWS it is "pooled multi tenancy model".
I'm using nest.js and sequelize. If sequelize is not a good fit for this I also could switch to another library like typeORM if necessary.
How can this be implemented? I'm absolutely clueless how I can use a different connection (different database user) for each HTTP request and also I don't know how to set a runtime context variable for the connection in a good way.
What I get currently is that every HTTP requests contains a header tenant-id. This should be used for all queries.
There is also the concept of scopes in sequelize. But this is something that is implemented on the client side and not on the database directly. Also, this is something that is specific to sequelize. I would prefer a solution that is independent from sequelize and maybe more specific to PostgreSQL.
Is there any way to implement this with sequelize? A hint or a basic approach would be sufficient.
That seems that this approach is similar. https://learn.microsoft.com/en-us/microsoft-365/education/deploy/design-multi-tenant-architecture.
I'm studding for create a similar architecture, but i will use the "silo" model or "physical database". I think that at first you need to create a internal database called "catalog" that will contains the information of the user (this user already have a login? if true select this information) where have to contains a previous credentials how tenant-id. About the Sequelize, i guess that is necessary to use RAW queries for create ROLE|GRANT|DATA BASE etc and the MIGRATIONS to create the same DB for each new clients.

Telosys : How can i get database table records in template?

I am using Telosys tools for code generation. It's very nice tool and help me a lot.
But there is one problem, that is, it provides database schema information and i can access in templates (templates are formerly velocity templates), which is good, but how can i get selected entity's data from database? There is no way i can find, by which i can get that selected table data.
Please provide solution if any, or provide alternate way to do it.
Thanking You!
Telosys Tools is designed to retrieve the model from the database,
not the data stored in the tables.
But it allows to create your own specific tooling classes usable
in the templates, so it's possible to create a specific Java Class to retrieve the data from the database.
There's an example of this kind of specific class in the "database-doc" bundle
https://github.com/telosys-tools/database-doc-bundle-TT210 ( in classes folder )
To simplify the loading the simplest way is to create the class in the "default package" (no java package)
NB:
The problem is that the jar containing the JDBC driver
is not accessible by the generator class-loader, so you will have to use a specific class-loader and to connect directly with the JDBC driver.
Here is an example : https://gist.github.com/l-gu/ed0c8726807e5e8dd83a
Don't use it as is (the connection is never closed) but it can be easily adapted.

Yii Gii with MongoDB

Could anyone please tell me how MongoDB can be used with YII?
How can we create controller and model functions using Gii if the database used is MongoDB?
I've used YiiMongoDBSuite (YMDS), which has some very rough support for Gii. You can generate starter classes, but given that MongoDB does not have a fixed schema you will need to edit the model to make them useful. There is an odd kludge that lets you generate MongoDB models from a SQL table, but this seems more effort than it's worth.
YMDS' EMongoDocument class extends the standard Yii CModel class, so this is a useful base if you want to build apps with CRUDS.
The unfortunate caveat is that YMDS is no longer maintained by the original author, and there are a few community forks to chose between.
The way of creating controllers is same as usual but you have to use an extension to talk to mongoDB from Yii ,
You need to use direct Mongo suite of yii . It is an extension which has a collection of components for the mongoDB .

Windows Workflow Persistence data (VS 2010 RC / .NET 4.0)

I have started working with Windows Workflow recently (the VS2010 RC / .NET 4.0 version) and am stuggling to get to grips with the SQL persistence functionality.
I have managed to attach persistence to my WorkflowServiceHost via an SqlWorkflowInstanceStoreBehavior object and in my database there are rows appearing in the [System.Activities.DurableInstancing].[InstancesTable] table.
However, I don't know how to make sense of any of this data (it seems as though quite a few columns are in binary format). How can I store custom data regarding my workflow in this? How do I retreive this from the table for MI style reporting?
I can't seem to find any info on the web regarding storing custom data (and then retrieving it again) - please help :)
Many thanks in advance!
The data you see is all use by the workflow persistence system and not really suitable for your own consumption. If you want to query on your own data you need to use a mechanism called property promotion that stores the data in a queryable format using the InstancePromotedProperties table. Basically you need to implement a PersistenceParticipant and overwrite the CollectValues() function to add the values to one of the collections.
See here for more details.

Zend_Auth_Adapter using a data mapper

First post here so sorry if I seem like a newb,
I am trying to find a way to use Zend_Auth_Adapter with a data mapper, but seem to be struggling. I know I can use Zend_Auth_Adapter_DbTable and associate this with a db table, but this seems to negate the whole reason for having a data mapper (I think)?! Should I be creating a custom adapter for the mapper so that I can use the mapper to choose whatever I want as my data source?
Good question. The proper way to do that would be to roll your own Zend_Auth_Adapter. I have done so for Doctrine (my ORM).
I also use the data mapper pattern throughout my application, but I do not use it for my authentication. It adds a lot of needless overhead imo. I just query the database directly using my Auth_Adapter.