Skip to content

Commit

Permalink
"normalize" the package name on package rules lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
marko-bekhta committed Mar 26, 2024
1 parent 28f0e2f commit 3b4f8fa
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1357,7 +1357,8 @@ public static Map<String, Set<String>> getModelClassesAndPackagesPerPersistenceU
}

for (String modelPackageName : jpaModel.getAllModelPackageNames()) {
Set<String> persistenceUnitNames = packageRules.get(modelPackageName);
// Package rules keys are "normalized" package names, so we want to normalize the package on lookup:
Set<String> persistenceUnitNames = packageRules.get(normalizePackage(modelPackageName));
if (persistenceUnitNames == null) {
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;

import org.hibernate.annotations.Filter;
import org.hibernate.annotations.JdbcTypeCode;
import org.hibernate.type.SqlTypes;

Expand All @@ -15,6 +16,8 @@
import io.quarkus.runtime.annotations.RegisterForReflection;

@Entity
@Filter(name = "ids-over-zero")
@Filter(name = "ids-over-zero-inner-package")
public class EntityWithJsonOtherPU {
@Id
@GeneratedValue
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@FilterDef(name = "ids-over-zero-inner-package", defaultCondition = "id > 0")
package io.quarkus.it.jpa.postgresql.otherpu.inner;

import org.hibernate.annotations.FilterDef;
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* This filter is useless in terms of filtering, but we want to be sure that
* Quarkus detects and processes ORM annotations defined at a package level:
*/
@FilterDef(name = "ids-over-zero", defaultCondition = "id > 0")
package io.quarkus.it.jpa.postgresql.otherpu;

import org.hibernate.annotations.FilterDef;
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ quarkus.hibernate-orm.database.generation=drop-and-create
quarkus.hibernate-orm.database.generation.create-schemas=true
# Define non-default PU so that we can configure a custom JSON format mapper. The default PU is using the default mapper.
quarkus.hibernate-orm."other".datasource=<default>
quarkus.hibernate-orm."other".packages=io.quarkus.it.jpa.postgresql.otherpu
quarkus.hibernate-orm."other".packages=io.quarkus.it.jpa.postgresql.otherpu,io.quarkus.it.jpa.postgresql.otherpu.inner
quarkus.hibernate-orm."other".database.generation=drop-and-create
quarkus.hibernate-orm."other".database.generation.create-schemas=true

Expand Down

0 comments on commit 3b4f8fa

Please sign in to comment.