Replies: 3 comments 15 replies
-
It would help if you can share your example project, something might be missing in the build file. |
Beta Was this translation helpful? Give feedback.
1 reply
-
Try Micronaut Launch, this link will have predefined data-jpa and h2 feature for simple use case. |
Beta Was this translation helpful? Give feedback.
2 replies
-
Do you have dependency |
Beta Was this translation helpful? Give feedback.
12 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
One of our micronaut 3 application has application.yml:
jpa:
default:
packages-to-scan:
- 'myapp.entities'
With micronaut 4 I got an test error:
[ERROR] DaoTest » BeanInstantiation Bean definition [org.hibernate.SessionFactory] could not be loaded: Error instantiating bean of type [org.hibernate.boot.SessionFactoryBuilder]
Message: Entities not found for JPA configuration: 'default' within packages ['myapp.entities']. Check that you have correctly specified a package containing JPA entities within the "jpa.default.entity-scan.packages" property in your application configuration and that those entities are either compiled with Micronaut or a build time index produced with @introspected(packages="foo.bar", includedAnnotations=Entity.class) declared on your Application class
Path Taken: SessionFactoryPerDataSourceFactory.buildHibernateSessionFactoryBuilder(SessionFactoryBuilder sessionFactoryBuilder) --> SessionFactoryPerDataSourceFactory.buildHibernateSessionFactoryBuilder([SessionFactoryBuilder sessionFactoryBuilder]) --> SessionFactoryPerDataSourceFactory.buildHibernateSessionFactoryBuilder([Metadata metadata],JpaConfiguration jpaConfiguration,String name)
So according to https://micronaut-projects.github.io/micronaut-data/4.6.0/guide/index.html
application configuration file should look like
jpa:
default:
entity-scan:
packages: 'myapp.entities'
In the project there is a @entity class located in package 'myapp.entities', so I changed application.yml to
jpa:
default:
entity-scan:
packages: 'myapp.entities'
I also changed my @MicronautTest code to
@MicronautTest
@introspected(packages="myapp.entities", includedAnnotations=Entity.class)
public class DaoTest {
...
But it still doesn’t work, and the error message is the same. How can I fix that? Do you have any detailed documentation, especially explaining how to migrate micronaut data 3 to 4?
Thanks,
Ethan
Beta Was this translation helpful? Give feedback.
All reactions