projects
/
hibernate4-maven-plugin
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
8e5921c
)
Sidestepped bug in Hibernate 5
author
Kai Moritz
<kai@juplo.de>
Thu, 17 Dec 2015 01:53:38 +0000
(
02:53
+0100)
committer
Kai Moritz
<kai@juplo.de>
Sun, 20 Dec 2015 20:09:03 +0000
(21:09 +0100)
src/main/java/de/juplo/plugins/hibernate/AbstractSchemaMojo.java
patch
|
blob
|
history
diff --git
a/src/main/java/de/juplo/plugins/hibernate/AbstractSchemaMojo.java
b/src/main/java/de/juplo/plugins/hibernate/AbstractSchemaMojo.java
index
b61d83c
..
d50a1e7
100644
(file)
--- a/
src/main/java/de/juplo/plugins/hibernate/AbstractSchemaMojo.java
+++ b/
src/main/java/de/juplo/plugins/hibernate/AbstractSchemaMojo.java
@@
-438,10
+438,13
@@
public abstract class AbstractSchemaMojo extends AbstractMojo
/** Load checksums for old mapping and configuration */
tracker.load();
/** Load checksums for old mapping and configuration */
tracker.load();
- /** Create a BootstrapServiceRegistry with special ClassLoader */
+ /** Create the ClassLoader */
+ URLClassLoader classLoader = createClassLoader();
+
+ /** Create a BootstrapServiceRegistry with the created ClassLoader */
BootstrapServiceRegistry bootstrapServiceRegitry =
new BootstrapServiceRegistryBuilder()
BootstrapServiceRegistry bootstrapServiceRegitry =
new BootstrapServiceRegistryBuilder()
- .applyClassLoader(c
reateClassLoader()
)
+ .applyClassLoader(c
lassLoader
)
.build();
ClassLoaderService classLoaderService =
bootstrapServiceRegitry.getService(ClassLoaderService.class);
.build();
ClassLoaderService classLoaderService =
bootstrapServiceRegitry.getService(ClassLoaderService.class);
@@
-520,7
+523,22
@@
public abstract class AbstractSchemaMojo extends AbstractMojo
);
}
);
}
- build((MetadataImplementor)metadataBuilder.build());
+ /**
+ * Change class-loader of current thread.
+ * This is necessary, because still not all parts of Hibernate 5 use
+ * the newly introduced ClassLoaderService and will fail otherwise!
+ */
+ Thread thread = Thread.currentThread();
+ ClassLoader contextClassLoader = thread.getContextClassLoader();
+ try
+ {
+ thread.setContextClassLoader(classLoader);
+ build((MetadataImplementor)metadataBuilder.build());
+ }
+ finally
+ {
+ thread.setContextClassLoader(contextClassLoader);
+ }
}
finally
{
}
finally
{