Is there a way to create the Entity classes in Micronaut from an existing SQL database? - micronaut-data

I could not find any documentation on this topic. For example, I can create the model classes in Eclipse using the JPA plugin.

Is there a way to create the Entity classes in Micronaut from an
existing SQL database?
If you mean a tool that is part of Micronaut that will read your schema and generate source code for Micronaut entities, the answer is that there is no such capability provided by Micronaut.

Related

Possible to mix mongodb gorm and regular java

I'm new to micronaut, I've used spring extensively. I like the GORM style of mapping entities but not keen on using groovy for everything on this new project. Is it possible to use groovy for my entities for gorm and the service + DAO's with java?
Is it possible to use groovy for my entities for gorm and the service
and DAO's with java?
If you are writing your own DAO's, then the answer is yes.
NOTE: Be aware that GORM Data Services in particular (http://gorm.grails.org/7.0.4/hibernate/manual/index.html#dataServices) have to be written in Groovy because their generation relies on Groovy AST transformations. We do not provide support for writing those in Java.

Trying to use Crate.io NoSql database with an existing Spring Data / Mysql project

I'm attempting to add Crate.IO capability to an existing Spring Data/Eclipselink/MySql web application. For this specific use case, we want to persist data to both MySql AND Crate (for evaluation purposes) in the most painless way possible. I'm using the Spring-Data-Crate project in order to be able to use Spring Data Repositories with Crate.
I've been able to setup a separate Crate specific entity manager with a filter to only utilize repos that implement CrateRepository. The problem I'm having is determining how to use the existing Spring Data/MySql entity classes with Crate. (or derive from them)
1) If I annotate an existing Spring Data #Entity class with the Spring-Data-Crate
#Table annotation, the mapping to the crate DB will fail because EclipseLink/JPA adds hidden persistence fields to entities objects that start with an underscore, which is apparently not allowed by the spring-data-crate adapter
2) I tried to use entity inheritance, with a base class that both the MySql and Crate entity can extend, with only the MySql entity having the spring data #Entity annotation. Unfortunately, this causes Spring Data to lose visibility of the base class fields unless the base class is annotated with #MappedSuperClass. But adding this annotation introduces the hidden "_"-prefixed persistence properties to the derived crate entity.
3) I could use separate entities entirely and have them implement a common interface, but I can't assign the interface as the type of the spring data crate repository.
... Not sure where to go from here
Spring Data Crate adapter project - https://github.com/KPTechnologyLab/spring-data-crate
Spring Data Crate Tutorial - https://crate.io/a/using-sprint-data-crate-with-your-java-rest-application/
i'm johannes from crate.
we didn't test the use of spring data crate in that manner so we can't state any information if this should or shouldn't work.
sorry, johannes

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.

C# Catel Framework & Entity Framework & Unity of Work

i want use the Entity Framework with Catel to use the UoW pattern in my code. I have reade this article:
http://www.geertvanhorrik.com/category/catel/page/2/
I create a new Project with the name "Database". In this project i implement my Application Models. At the moment i store the data in a XML file but i want store it in a SQL Database in the future. My models a derived from "SaveableModelBase".
public class SettingsDataObject : SavableModelBase
1) What must i do to use the Entityframework? Is there a EntityModelBase or something?
2) How i must design my model classes?
2) How i register the Repositories with the ServiceLocator? RegisterType< ..., ...>?
3) Can i use the "Code First" and AutoGenerate Database Tables in Catel?
Where i can find a good basic code Example to implement the UoW pattern with Catel?
What must i do to implement a UoW with Catel?
I hope anybody can help me,
Thank you & Greetings
Catel does not provide base classes for Entity Framework. EF is normally used in combination with SQL server databases. It cannot be used in combination with the SavableModelBase.
For more information, see the official documentation:
https://catelproject.atlassian.net/wiki/display/CTL/Catel.Extensions.EntityFramework5

How to read the schema used by a JPA implementation

My EntityManager is using a persistence unit that uses a data source provided by our Websphere configuration. The DS configuration includes an environment specific DB to use.
The EM successfully uses this schema, but I can't figure out a way to log or display the schema being used. I was thing something like em.getCurrentSchema would be available..
Any help would be great, thanks.
No API to do this (in JPA). You could do it via JDBC and use of DatabaseMetaData.
JPA is to provide an object view of the data and ease persistence of those objects, not to just present datastore specifics to the user.