Skip to content

JPA default entity scan fails on newly created project #388

@vcupelloni

Description

@vcupelloni
Overview of the issue

It seems that by creating a new microservice from scratch without entities and with User entity creation disabled, it cannot then be started due to an error in JPA's automatic entity scan.

image

Creating even a single entity with jhipster generator solves all the problems and the project can run.

Reproduce the error

Install JHipster and Micronaut blueprint, configure an application (in the screenshot I used microservice/postgresql/ehcache but itried several configuration with same results) , start the project after generation is completed.

image

Suggest a Fix

I am not aware of a parameter to disable JPA's autoscan, the only way I found to start the application is to comment out in the build.gradle file the dependency to io.micronaut.data:micronaut-data-hibernate-jpa

Is it feasible that this dependency will only be added if there is at least one entity?

Project configuration
JHipster configuration, a .yo-rc.json file generated in the root folder
.yo-rc.json file
{
  "generator-jhipster": {
    "applicationType": "microservice",
    "authenticationType": "jwt",
    "backendType": "micronaut",
    "baseName": "myprojectMicroservice",
    "blueprints": [
      {
        "name": "generator-jhipster-micronaut",
        "version": "3.4.1"
      }
    ],
    "buildTool": "gradle",
    "cacheProvider": "ehcache",
    "clientFramework": "no",
    "clientTestFrameworks": null,
    "clientTheme": null,
    "creationTimestamp": 1724496465308,
    "devDatabaseType": "h2Disk",
    "enableGradleEnterprise": false,
    "enableHibernateCache": true,
    "enableSwaggerCodegen": false,
    "enableTranslation": true,
    "entities": [],
    "gradleEnterpriseHost": null,
    "jhipsterVersion": "8.5.0",
    "languages": [
      "it"
    ],
    "messageBroker": "no",
    "microfrontend": null,
    "microfrontends": [],
    "nativeLanguage": "it",
    "packageName": "com.mycompany.myapp",
    "prodDatabaseType": "postgresql",
    "searchEngine": "no",
    "serverPort": 8081,
    "serverTestFrameworks": [],
    "serviceDiscoveryType": "consul",
    "skipClient": true,
    "syncUserWithIdp": null,
    "testFrameworks": [
      []
    ],
    "withAdminUi": null
  }
}
Environment and Tools

openjdk version "21.0.4" 2024-07-16
OpenJDK Runtime Environment (build 21.0.4+7)
OpenJDK 64-Bit Server VM (build 21.0.4+7, mixed mode, sharing)

git version 2.46.0

node: v18.19.1
npm: 10.2.4

Docker version 27.1.2, build d01f264bcc

  • [ X ] Checking this box is mandatory (this is just to show you read everything)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions