0

Probably if you have an example repository with a project modularized with maven that separates domain and infra it could help me.

I have a project with this modular archtecture:

parentProject
  |-domain
  |-infrastructure
  |-app

In infrastructure module I have repositories accessing databases. I put in its META-INF the file persistence.xml. The problem seems to be that Hibernate can't reach NamedQueries in domain module.

Update 1:

I added in my persistence file the following line:

<jar-file>../domain/target/domain-1.0.0-SNAPSHOT.jar</jar-file>

And the error ended, however, now I'm getting another error:

org.hibernate.hql.internal.ast.QuerySyntaxException: MyClass is not mapped I tried to add the line:

<class>br.com.leandro.model.MyClass</class>

But the error persists.

The first error I got trying to create a named query in DOMAIN module, for this new error, I'm trying to create a native query in the INFRASTRUCTURE module.

If any futher information or piece of code is necessary, let me know and I'll be glad to provide it.

Leandro Lima
  • 1,140
  • 3
  • 24
  • 42

1 Answers1

0

The problem was that I have two persistences in the same file and I put <jar-file>../domain/target/domain-1.0.0-SNAPSHOT.jar</jar-file> only in one of them.

Leandro Lima
  • 1,140
  • 3
  • 24
  • 42