Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Entities with JpaRepository only #17436

Closed
1 task
pascalgrimaud opened this issue Dec 28, 2021 · 13 comments
Closed
1 task

Entities with JpaRepository only #17436

pascalgrimaud opened this issue Dec 28, 2021 · 13 comments
Labels
area: feature request 💡 $$ bug-bounty $$ https://www.jhipster.tech/bug-bounties/ theme: entities theme: JDL $500 https://www.jhipster.tech/bug-bounties/
Milestone

Comments

@pascalgrimaud
Copy link
Member

pascalgrimaud commented Dec 28, 2021

Overview of the feature request

It could be a 1st step of @jdubois's idea in the mailing list.
I wonder if we could use the JDL to generate only the entities and jpa part, and ignoring Service, DTO, Rest, front, etc

Maybe we could only keep the liquibase part, I don't know.

Motivation for or Use Case

If the JDL can work in all Spring Boot projects, without the requirement of the base of JHipster project, it will be a killer feature.

Related issues or PR
  • Checking this box is mandatory (this is just to show you read everything)
@pascalgrimaud
Copy link
Member Author

pascalgrimaud commented Dec 28, 2021

Cc @mshima as you're our expert on this part. What do you think?
I can try to implement it, if you find the idea not bad and if you think it's doable

Cc @MathieuAA too

@pascalgrimaud pascalgrimaud added $$ bug-bounty $$ https://www.jhipster.tech/bug-bounties/ $500 https://www.jhipster.tech/bug-bounties/ labels Dec 28, 2021
@MathieuAA
Copy link
Member

It's easy to do. Again, the generation part is done by the generator and there's no change to do in the "JDL part" of the code base: once the .JSON files are generated, it's up to a generator to read the JSON entity files and do its magic.

@mshima
Copy link
Member

mshima commented Dec 28, 2021

Cc @mshima as you're our expert on this part. What do you think?

Can somewhat be accomplished by jhipster jdl bug-tracker.jh --ignore-application --db sql --skip-client

Missing the --skip-rest option.

I will try an entity only jdl.

@pascalgrimaud
Copy link
Member Author

Interesting! Will try it soon.
Don't hesitate to ping me if you need me to do something

@mshima
Copy link
Member

mshima commented Dec 28, 2021

I will try a entity only jdl.

Application is currently required to parse the jdl.

INFO! The JDL is being parsed.
Error: The JDL object, the application's name and its the database type are mandatory.
Error while parsing applications and entities from the JDL Error: The JDL object, the application's name and its the database type are mandatory.
Error: The JDL object, the application's name and its the database type are mandatory.

@MathieuAA
Copy link
Member

@mshima Yes, it's kinda mandatory so as to validate the provided entities. Removing this check can easily be done though

@nomuna
Copy link
Contributor

nomuna commented Jan 11, 2022

So I tried the following with the current version.

jhipster import-jdl --skip-client --ignore-application model\21-points_mvn.jh

21-points_mvn.jh is the file 21-points.jh from the jdl-samples project where the build tool was set to maven.

The convent of the directory after the command is run is as follows

skip_client_ignore_app_21_points

So the functionality is "there". I can not imagine anyone who would say no to generated rest controllers and repositories for their entities. Hehe. :D

@pascalgrimaud
Copy link
Member Author

@nomuna : it depends on your needs and on your project:

  • sometimes, you have Entities you don't want to expose in API
  • it's not specially a good practice to expose the entity as this, you should always map to another object
  • Rest Controller is not the only one input of your application, you can have Listener, CLI, etc

@nomuna
Copy link
Contributor

nomuna commented Jan 12, 2022

@pascalgrimaud So basically if you add another option to disable the rest stuff and repository stuff it would be enough, yes?

At the moment whoever needs this functionality could remove the rest/repository code. Not saying that the ticket does not make sense or anything. Just pointing out what is there and see how far I can go using the already available means so that what can and should be done is clarified.

@pascalgrimaud
Copy link
Member Author

@nomuna : here some use cases

1st use case:

  • init your project with Spring Initializr https://start.spring.io/
  • add appropriate dependencies
  • use JHipster to generate Entities and Jpa Repositories

2nd use case:

  • existing Spring Boot project
  • use JHipster to generate Entities and Jpa Repositories

So as discussed in the mailing list, we think it could be a great option to use the JDL in existing Spring Boot projects, without the need of JHipster projects.

@Tcharl
Copy link
Contributor

Tcharl commented Feb 3, 2022

Hello,

If you implement it, please keep in mind the discussion we had here: #14416

IMHO inclusive options will fix one pain point we'll face in regard to exclusive syntax

@pascalgrimaud
Copy link
Member Author

I don't plan to implement it and not sure if we should do it.
I can play with git, by reverting some part I don't want, and it should do the trick

@pascalgrimaud
Copy link
Member Author

Followed my last comment, no need to implement it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: feature request 💡 $$ bug-bounty $$ https://www.jhipster.tech/bug-bounties/ theme: entities theme: JDL $500 https://www.jhipster.tech/bug-bounties/
Projects
None yet
Development

No branches or pull requests

6 participants