fbpx

Grails integration

Find out how to integrate JSQL with Java EE

Stack requirements

The JSQL Grails plugin will not work without an account in the JSQL cloud and a application written in Grails. To learn more see overview.

Installation

Add JSQL artifactory into your maven repositories in your project.

For Maven setup:

<repositories>
<repository>
<id>maven</id>
<url>https://nexus.jsql.it/nexus/content/repositories/releases/</url>
</repository>
</repositories>

For Gradle setup:

repositories {

    mavenCentral()
    maven{
        url "https://nexus.jsql.it/nexus/content/repositories/releases/"
    }

}

Then add jsql-grails-plugin dependency:

Releases list

For Maven setup:

<dependency>
<groupId>jsql</groupId>
<artifactId>grails-plugin</artifactId>
<version>1.2.3</version>
<type>pom</type>
</dependency>

For Gradle setup:

compile "jsql:grails-plugin:1.2.3"

Integration

The JSQL plugin for Grails has very simple configuration. All you need to do is provide API_KEY and DEV_KEY.

The API_KEY and DEV_KEY we can get from JSQL Admin Panel, see FAQ for details.

You should store them in application.groovy file:

jsql.apiKey = 'iSqF8rKvVeSgqudKDOXpjiFgGMJh1PbeouIz9IW6gogpoSXm6yrU'
jsql.devKey = 'Z6kEovODxAv2I5hKekM'

Usage

If your application is integrated using the JSQL plugin, you can start it and try to call the query using CURL:

curl 'http://localhost:8080/jsql/select' -H 'Accept: application/json' -H 'Content-Type: application/json' 
--data-binary '{"token":"OXpjiFgGMJh1PbeouIz9IW6","params":{}}' --compressed

Url mappings

By default, JSQL controller is mapped by Grails default mapping. You can change it by adding mapping to UrlMappings file

"/api/jsql/$action?"(controller: "jsql")

Then JSQL controller is available on http://localhost:8080/api/jsql

What next?

Close Menu