Connecting MPS to Mysql using JPA?

Hi,

1.)  Is it possible to make maven or gradle application within the MPS.

2.)if it is yes how can i do that?

3.)How can i use JPA repository to access DB from MPS Application

 

 

 

5 comments
Comment actions Permalink

It's possible but there are a lot of non trivial issues =) Be ready for a lot of pain and a lack of documentation.

For example, in my project I have two build script: the first one prepares artifacts for mps and another creates standalone mps as final artifact.

These two build script have the same inner tasks so we can't just run them in the same command. So, we need to execute one build script per command (I couldn't find another solution).

I use gradle:

1) Get current task name: def currentTask = project.gradle.startParameter.taskNames.first()

2) Handle command and import proper ant task:

if (currentTask == "mpsbuild") {
ant.importBuild('build.xml') { antTargetName -> 'mps' + antTargetName }
}

Also, you should set mps_home property before importing. For example, if you use gradle inside the MPS (from terminal tool window):

ant.properties['mps_home'] = System.getenv('IDE_HOME')

0
Comment actions Permalink

Out of curiosity, what are you guys doing that you need to use JPA and access databases from MPS? I'm thinking of creating a sample for it but I'd like to understand what would be useful as an example.

0
Comment actions Permalink

Sergej Koščejev, just a small example. Imagine that user would like to select values from something like "catalog".

You can implement it like enum but it's hardcode. Also, enum in MPS is not very comfortable so we try to avoid this.

So, you can implement this "catalog" as nodes with table view OR you can get them somehow from database.

P.S. I don't use JPA and datables in project but I understand the aim =)

0
Comment actions Permalink

Hi @Sergej Koščejev

In our application we are trying to define some table structure in the editor and use the each and every cell value for our calculation process.

So for that we need to access the DB to get the list of data and we have to calculate one by one data from the list with respect to the table cell value and need to store again in a DB itself.

So for that we need those kind of stuffs..,.

Is it possible ?

Even for creating table and accessing cell by cell value in our MPS Java code is also a very difficult,we are still trying to create a perfect table and access the cell by cell value ,Even till here is very difficult...

0
Comment actions Permalink

Regarding tables: don't use the built-in MPS tables, use the ones from Sascha Lißon, part of MPS-extensions (the language is named de.slisson.mps.tables). Here's a tutorial from Federico Tomassetti on those tables: https://tomassetti.me/tabular-projections-in-jetbrains-mps-lets-start-building-an-accounting-system/ -- let me know if it helps or if you need something more.

Regarding DB access, I'll try to come up with a sample.

1

Please sign in to leave a comment.