-
Couldn't load subscription status.
- Fork 41.6k
Disable Hibernate entity scanning for default JPA setup #15565
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,6 +34,7 @@ | |
| * Configuration properties for Hibernate. | ||
| * | ||
| * @author Stephane Nicoll | ||
| * @author Artsiom Yudovin | ||
| * @since 2.1.0 | ||
| * @see JpaProperties | ||
| */ | ||
|
|
@@ -56,6 +57,13 @@ public class HibernateProperties { | |
| */ | ||
| private Boolean useNewIdGeneratorMappings; | ||
|
|
||
| /** | ||
| * Archive Scanner. This is actually a shortcut for the "hibernate.archive.scanner" | ||
| * property. When not specified will default to | ||
| * "org.hibernate.boot.archive.scan.internal.DisabledScanner". | ||
| */ | ||
| private String archiveScanner = "org.hibernate.boot.archive.scan.internal.DisabledScanner"; | ||
|
|
||
| public String getDdlAuto() { | ||
| return this.ddlAuto; | ||
| } | ||
|
|
@@ -72,6 +80,14 @@ public void setUseNewIdGeneratorMappings(Boolean useNewIdGeneratorMappings) { | |
| this.useNewIdGeneratorMappings = useNewIdGeneratorMappings; | ||
| } | ||
|
|
||
| public String getArchiveScanner() { | ||
| return this.archiveScanner; | ||
| } | ||
|
|
||
| public void setArchiveScanner(String archiveScanner) { | ||
| this.archiveScanner = archiveScanner; | ||
| } | ||
|
|
||
| public Naming getNaming() { | ||
| return this.naming; | ||
| } | ||
|
|
@@ -95,6 +111,7 @@ private Map<String, Object> getAdditionalProperties(Map<String, String> existing | |
| HibernateSettings settings) { | ||
| Map<String, Object> result = new HashMap<>(existing); | ||
| applyNewIdGeneratorMappings(result); | ||
| applyArchiveScanner(result); | ||
| getNaming().applyNamingStrategies(result); | ||
| String ddlAuto = determineDdlAuto(existing, settings::getDdlAuto); | ||
| if (StringUtils.hasText(ddlAuto) && !"none".equals(ddlAuto)) { | ||
|
|
@@ -121,6 +138,10 @@ else if (!result.containsKey(AvailableSettings.USE_NEW_ID_GENERATOR_MAPPINGS)) { | |
| } | ||
| } | ||
|
|
||
| private void applyArchiveScanner(Map<String, Object> result) { | ||
| result.put(AvailableSettings.SCANNER, this.archiveScanner); | ||
|
||
| } | ||
|
|
||
| private String determineDdlAuto(Map<String, String> existing, | ||
| Supplier<String> defaultDdlAuto) { | ||
| String ddlAuto = existing.get(AvailableSettings.HBM2DDL_AUTO); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update but that's not what I meant. There shouldn't be any property at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
property was removed