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

Add relationships and reactive support to custom entity packages. #16592

Merged
merged 3 commits into from
Oct 13, 2021

Conversation

mshima
Copy link
Member

@mshima mshima commented Oct 6, 2021

Followup to #16041.

  • Change webflux workflow to allow a sample to use more than one JDL files.
    Having JDLs instead of .yo-rc.json and .jhipster/* entities is cleaner and easier to maintain.
  • Split EntitySqlHelper class to a file, so it can be imported by another package.
  • Create separated files-sql.json for modularity.

Please make sure the below checklist is followed for Pull Requests.

When you are still working on the PR, consider converting it to Draft (below reviewers) and adding skip-ci label, you can still see CI build result at your branch.

@mshima
Copy link
Member Author

mshima commented Oct 8, 2021

@mraible should fix your jdl #16041 (comment)

Copy link
Contributor

@mraible mraible left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can confirm this fixes the problem, everything compiles, and e2e tests pass. As I was running these tests, I noticed that all the entity classes are generated at the root level and I thought to myself, "wouldn't it be cool if I could put all generated entity-related classes in their own sub-package?"

I tried @EntityPackage(app.blog) and @EntityPackage(app/blog) and neither of them work. Just wanted to make a note of this since others might think of this too.

@mshima
Copy link
Member Author

mshima commented Oct 11, 2021

I tried @EntityPackage(app.blog)

@mraible should work now using @EntityPackage("app.blog")

@mraible
Copy link
Contributor

mraible commented Oct 13, 2021

Double quotes works splendidly! 🎉

It looks like single quotes aren't supported:

Error during import-jdl: Error: unexpected character: ->'<- at offset: 319, skipped 1 characters.
Error: unexpected character: ->'<- at offset: 319, skipped 1 characters.

Here's the JDL I used to test:

application {
  config {
    baseName blog
    reactive true
    applicationType monolith
    authenticationType oauth2
    packageName com.jhipster.demo
    prodDatabaseType mysql
    cacheProvider ehcache
    buildTool maven
    clientFramework angular
    testFrameworks [cypress]
  }
  entities *
}

@EntityPackage("app.blog")
entity Blog {
  name String required minlength(3)
  handle String required minlength(2)
}

@EntityPackage("app.post")
entity Post {
  title String required
  content TextBlob required
  date Instant required
}

@EntityPackage("app.tag")
entity Tag {
  name String required minlength(2)
}

relationship ManyToOne {
  Blog{user(login)} to User
  Post{blog(name)} to Blog
}

relationship ManyToMany {
  Post{tag(name)} to Tag{entry}
}

paginate Post, Tag with infinite-scroll

Screen Shot 2021-10-12 at 10 28 10 PM

@mraible
Copy link
Contributor

mraible commented Oct 13, 2021

Merging because this is a really cool feature.

@mraible mraible merged commit 8b14b27 into jhipster:main Oct 13, 2021
@pascalgrimaud pascalgrimaud added this to the 7.4.0 milestone Oct 14, 2021
@mshima mshima deleted the skip_ci-packages_relationships branch February 18, 2022 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants