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

Support multiple Hibernate ORM persistence units via Quarkus configuration #11322

Merged
merged 15 commits into from
Aug 21, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public final class HibernateOrmProcessor {

public static final String HIBERNATE_ORM_CONFIG_PREFIX = "quarkus.hibernate-orm.";
public static final String NO_SQL_LOAD_SCRIPT_FILE = "no-file";
public static final String DEFAULT_PERSISTENCE_UNIT_NAME = "default";
public static final String DEFAULT_PERSISTENCE_UNIT_NAME = "<default>";
Copy link
Member

Choose a reason for hiding this comment

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

What do you mean by "has special meaning", is it not possible for a user to speficy this name explicitly?

Copy link
Member Author

Choose a reason for hiding this comment

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

The idea was to avoid a conflict between the default one and a potential named PU called "default". Thus why I added the special characters. Also, it's consistent with the Agroal extension.


private static final Logger LOG = Logger.getLogger(HibernateOrmProcessor.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public void testJaxbAnnotationTransfer() {
/**
* _PanacheEntityBase_ has the method _isPersistent_. This method is used by Jackson to serialize the attribute *peristent*
* in the JSON which is not intended. This test ensures that the attribute *persistent* is not generated when using Jackson.
*
*
* This test does not interact with the Quarkus application itself. It is just using the Jackson ObjectMapper with a
* PanacheEntity. Thus this test is disabled in native mode. The test code runs the JVM and not native.
*/
Expand All @@ -104,7 +104,7 @@ public void jacksonDeserializationIgnoresPersistentAttribute() throws JsonProces
// make sure the Jaxb module is loaded
objectMapper.findAndRegisterModules();
String personAsString = objectMapper.writeValueAsString(person);
// check
// check
// hence no 'persistence'-attribute
assertEquals(
"{\"id\":null,\"name\":\"max\",\"uniqueName\":null,\"address\":null,\"status\":null,\"dogs\":[],\"serialisationTrick\":1}",
Expand Down Expand Up @@ -182,7 +182,7 @@ public void testMetrics() {
RestAssured.when()
.get("/metrics")
.then()
.body(containsString("vendor_hibernate_orm_timestamps_cache_hits_total{entityManagerFactory=\"default\"}"));
.body(containsString("vendor_hibernate_orm_timestamps_cache_hits_total{entityManagerFactory=\"<default>\"}"));
}

@DisabledOnNativeImage
Expand Down