EntityManagetFactory unwrap - HHH-9665
by Hardy Ferentschik
Hi there,
Steve and I are having a discussion around the intended behavior of EntityManagerFactory#unwrap.
See also HHH-9665[1] and the corresponding pull request [2].
At the moment the implementation in EntityManagerFactoryImpl allows to unwrap into the implementation
class itself. This way the user gets a reference to an internal class. IMO there should be instead a
public interface which the user can unwrap to, eg HibernateEntityManagerFactory. This interface hosts
additional methods we want to expose on top of the HibernateEntityManagerFactory. The unwrapping to
should be disallowed (by expception) in this case. IMO this is just a continuation of the whole
idea of splitting packages between public, spi and internal. Of course this cannot stop a user from
doing an explicit cast, but that's a different story imo.
Steve and I have different take on this issue, so we where wondering what others think?
--Hardy
[1] https://hibernate.atlassian.net/browse/HHH-9665
[2] https://github.com/hibernate/hibernate-orm/pull/911
8 years, 11 months
[Validator] Build problems!?
by Hardy Ferentschik
Hi,
I seem to have a odd build problem and wondering whether someone could verify the problem
or in any ways enlighten me regarding what's going on.
I can build the Validator master branch w/o problem ('mvn clean install'), but a 'mvn deploy' (SNAPSHOT deploy)
fails (output below). The funny thing is that the failure seems to occur during the main
compilation task which seems odd, since the classes compile fine when using the 'install' target.
It might be related to the fact that a 'deploy' enables different profiles/settings, but a start
would be to figure out whether others have the same problem.
-- Hardy
P.S.: The Cloudbees HV-5.2-SNAPSHOT-DEPLOY job recently also fails erratically. It might be the same problem.
>>>>
mvn deploy
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] Hibernate Validator Aggregator
[INFO] Hibernate Validator Test Utils
[INFO] Hibernate Validator Engine
[INFO] Hibernate Validator Engine JDK 1.8 Tests
[INFO] Hibernate Validator Portable Extension
[INFO] Hibernate Validator TCK Runner
[INFO] Hibernate Validator Wildfly Integration Tests
[INFO] Hibernate Validator Annotation Processor
[INFO] Hibernate Validator Performance Tests
[INFO] Hibernate Validator OSGi Modules
[INFO] Hibernate Validator Karaf Features
[INFO] Hibernate Validator OSGi integration test
[INFO] Hibernate Validator Manual
[INFO] Hibernate Validator Distribution
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Hibernate Validator Aggregator 5.2.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-enforcer-plugin:1.0.1:enforce (enforce-java) @ hibernate-validator-parent ---
[INFO]
[INFO] --- maven-install-plugin:2.3.1:install (default-install) @ hibernate-validator-parent ---
[INFO] Installing /Users/hardy/work/hibernate/git/beanvalidation/validator/pom.xml to /Users/hardy/tmp/m2/org/hibernate/hibernate-validator-parent/5.2.0-SNAPSHOT/hibernate-validator-parent-5.2.0-SNAPSHOT.pom
[INFO]
[INFO] --- maven-deploy-plugin:2.7:deploy (default-deploy) @ hibernate-validator-parent ---
Downloading: https://repository.jboss.org/nexus/content/repositories/snapshots/org/hib...
Downloaded: https://repository.jboss.org/nexus/content/repositories/snapshots/org/hib... (620 B at 0.3 KB/sec)
Uploading: https://repository.jboss.org/nexus/content/repositories/snapshots/org/hib...
Uploaded: https://repository.jboss.org/nexus/content/repositories/snapshots/org/hib... (33 KB at 8.2 KB/sec)
Downloading: https://repository.jboss.org/nexus/content/repositories/snapshots/org/hib...
Downloaded: https://repository.jboss.org/nexus/content/repositories/snapshots/org/hib... (839 B at 0.9 KB/sec)
Uploading: https://repository.jboss.org/nexus/content/repositories/snapshots/org/hib...
Uploaded: https://repository.jboss.org/nexus/content/repositories/snapshots/org/hib... (620 B at 0.3 KB/sec)
Uploading: https://repository.jboss.org/nexus/content/repositories/snapshots/org/hib...
Uploaded: https://repository.jboss.org/nexus/content/repositories/snapshots/org/hib... (839 B at 0.5 KB/sec)
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Hibernate Validator Test Utils 5.2.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-enforcer-plugin:1.0.1:enforce (enforce-java) @ hibernate-validator-test-utils ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ hibernate-validator-test-utils ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/hardy/work/hibernate/git/beanvalidation/validator/test-utils/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.2:compile (default-compile) @ hibernate-validator-test-utils ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 11 source files to /Users/hardy/work/hibernate/git/beanvalidation/validator/test-utils/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ hibernate-validator-test-utils ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/hardy/work/hibernate/git/beanvalidation/validator/test-utils/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.2:testCompile (default-testCompile) @ hibernate-validator-test-utils ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.15:test (default-test) @ hibernate-validator-test-utils ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ hibernate-validator-test-utils ---
[INFO] Building jar: /Users/hardy/work/hibernate/git/beanvalidation/validator/test-utils/target/hibernate-validator-test-utils-5.2.0-SNAPSHOT.jar
[INFO]
[INFO] --- maven-checkstyle-plugin:2.14:checkstyle (check-style) @ hibernate-validator-test-utils ---
[INFO] Starting audit...
Audit done.
[WARNING] Unable to locate Source XRef to link to - DISABLED
[INFO]
[INFO] --- maven-install-plugin:2.3.1:install (default-install) @ hibernate-validator-test-utils ---
[INFO] Installing /Users/hardy/work/hibernate/git/beanvalidation/validator/test-utils/target/hibernate-validator-test-utils-5.2.0-SNAPSHOT.jar to /Users/hardy/tmp/m2/org/hibernate/hibernate-validator-test-utils/5.2.0-SNAPSHOT/hibernate-validator-test-utils-5.2.0-SNAPSHOT.jar
[INFO] Installing /Users/hardy/work/hibernate/git/beanvalidation/validator/test-utils/pom.xml to /Users/hardy/tmp/m2/org/hibernate/hibernate-validator-test-utils/5.2.0-SNAPSHOT/hibernate-validator-test-utils-5.2.0-SNAPSHOT.pom
[INFO]
[INFO] --- maven-deploy-plugin:2.7:deploy (default-deploy) @ hibernate-validator-test-utils ---
Downloading: https://repository.jboss.org/nexus/content/repositories/snapshots/org/hib...
Downloaded: https://repository.jboss.org/nexus/content/repositories/snapshots/org/hib... (1007 B at 1.1 KB/sec)
Uploading: https://repository.jboss.org/nexus/content/repositories/snapshots/org/hib...
Uploaded: https://repository.jboss.org/nexus/content/repositories/snapshots/org/hib... (27 KB at 13.9 KB/sec)
Uploading: https://repository.jboss.org/nexus/content/repositories/snapshots/org/hib...
Uploaded: https://repository.jboss.org/nexus/content/repositories/snapshots/org/hib... (2 KB at 1.4 KB/sec)
Downloading: https://repository.jboss.org/nexus/content/repositories/snapshots/org/hib...
Downloaded: https://repository.jboss.org/nexus/content/repositories/snapshots/org/hib... (303 B at 0.3 KB/sec)
Uploading: https://repository.jboss.org/nexus/content/repositories/snapshots/org/hib...
Uploaded: https://repository.jboss.org/nexus/content/repositories/snapshots/org/hib... (1007 B at 0.8 KB/sec)
Uploading: https://repository.jboss.org/nexus/content/repositories/snapshots/org/hib...
Uploaded: https://repository.jboss.org/nexus/content/repositories/snapshots/org/hib... (303 B at 0.2 KB/sec)
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Hibernate Validator Engine 5.2.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-enforcer-plugin:1.0.1:enforce (enforce-java) @ hibernate-validator ---
[INFO]
[INFO] --- jaxb2-maven-plugin:1.3.1:xjc (default) @ hibernate-validator ---
[INFO] No changes detected in schema or binding files, skipping source generation.
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ hibernate-validator ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 13 resources
[INFO] Copying 4 resources to META-INF
[INFO]
[INFO] --- maven-compiler-plugin:3.2:compile (default-compile) @ hibernate-validator ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 367 source files to /Users/hardy/work/hibernate/git/beanvalidation/validator/engine/target/classes
An exception has occurred in the compiler (1.8.0_25). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport) after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you.
java.lang.IllegalStateException: endPosTable already set
at com.sun.tools.javac.util.DiagnosticSource.setEndPosTable(DiagnosticSource.java:136)
at com.sun.tools.javac.util.Log.setEndPosTable(Log.java:350)
at com.sun.tools.javac.main.JavaCompiler.parse(JavaCompiler.java:667)
at com.sun.tools.javac.main.JavaCompiler.parseFiles(JavaCompiler.java:950)
at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.<init>(JavacProcessingEnvironment.java:892)
at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.next(JavacProcessingEnvironment.java:921)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1187)
at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1170)
at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:856)
at com.sun.tools.javac.main.Main.compile(Main.java:523)
at com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:129)
at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:138)
at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess(JavaxToolsCompiler.java:125)
at org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile(JavacCompiler.java:169)
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:823)
at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:129)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:582)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] An unknown compilation problem occurred
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Hibernate Validator Aggregator ..................... SUCCESS [ 11.399 s]
[INFO] Hibernate Validator Test Utils ..................... SUCCESS [ 10.637 s]
[INFO] Hibernate Validator Engine ......................... FAILURE [ 1.835 s]
[INFO] Hibernate Validator Engine JDK 1.8 Tests ........... SKIPPED
[INFO] Hibernate Validator Portable Extension ............. SKIPPED
[INFO] Hibernate Validator TCK Runner ..................... SKIPPED
[INFO] Hibernate Validator Wildfly Integration Tests ...... SKIPPED
[INFO] Hibernate Validator Annotation Processor ........... SKIPPED
[INFO] Hibernate Validator Performance Tests .............. SKIPPED
[INFO] Hibernate Validator OSGi Modules ................... SKIPPED
[INFO] Hibernate Validator Karaf Features ................. SKIPPED
[INFO] Hibernate Validator OSGi integration test .......... SKIPPED
[INFO] Hibernate Validator Manual ......................... SKIPPED
[INFO] Hibernate Validator Distribution ................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 24.389 s
[INFO] Finished at: 2015-04-21T10:30:39+02:00
[INFO] Final Memory: 34M/374M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.2:compile (default-compile) on project hibernate-validator: Compilation failure
[ERROR] An unknown compilation problem occurred
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
9 years
HHH-9701 - Develop "immutable EntityEntry" impl
by John O'Hara
Steve,
I have pushed a proposal for HHH-9701 to:
https://github.com/johnaoahra80/hibernate-orm/tree/HHH-9701
There are a couple of areas that I would appreciate feedback;
1) Serialization/Deserialization - EntityEntries implementations can be
serialized and each implementation provide their own serialization
method. I have modified the serialization of EntityEntry in
EntityEntryContext to write the Implementation class to the OutputStream
so the correct class can be used to deserialize the object stream. Is
the exception handling sufficient here, or do we need more robust
handling of deserialization exceptions? : see
https://github.com/johnaoahra80/hibernate-orm/commit/ec9b1fa3b97131ff1e65...
2) In our (perf team) use case, we want to be able to share the
ImmutableEntityEntry between sessions when they are referenced cached in
the 2lc. I have modified EntityEntryContext to not null
managedEntity.$$_hibernate_setEntityEntry if the EntityEntry is an
instance of ImmutableEntityEntry. Do we need to add an extra checks
here, to ensure that the entity is Reference Cached? I am not sure how
we would test that case? : see
https://github.com/johnaoahra80/hibernate-orm/commit/ec9b1fa3b97131ff1e65...
3) Lock Mode: Steve you mentioned about not doing locking for Immutable
entities. Where is the locking implemented? Would it be sufficient to
simply set the LockMode on the ImmutableEntityEntry to NONE/READ_ONLY
when setLockMode is called?
Thanks
John
--
John O'Hara
johara(a)redhat.com
JBoss, by Red Hat
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom.
Registered in UK and Wales under Company Registration No. 3798903 Directors: Michael Cunningham (USA), Charlie Peters (USA), Matt Parsons (USA) and Michael O'Neill (Ireland).
9 years
OGM test refactoring
by Jonathan Halliday
In the course of developing the cassandra backend for OGM I've hit an
issue with some of the backendtck tests.
These tests are in core and reused by each backend. It's possible to
exclude tests at class or method level per backend, which prevents
irrelevant tests from running for a given backend. So far, so good.
The problem I'm seeing stems from the fact that even when a test is
excluded, the annotated POJOs it uses are still parsed and passed
through schema creation, since that occurs in a setup step before the
individual tests are iterated and (not) run.
There are certain POJOs that contains mappings cassandra can't support.
Even with the corresponding test disabled, when these are passed to the
schema creator it blows up, effectively preventing the other legitimate
tests in the same class from running.
In an ideal world I'd like a class/method level annotation listing the
required POJOs to replace the getAnnotatedClasses method, allowing POJOs
to be parsed or skipped in accordance with the corresponding annotation
on the same test method.
@RequiredPOJO(Foo.class)
@Test
@SkipByGridDialect(...)
public void testFoo()
Alternatively I can (I think) subclass the test class in the backend and
override the getAnnotatedClasses method to exclude the problem POJOs,
whilst leaving the @SkipByGridDialect on the shared parent for clarity.
Or simply copy and paste the whole thing and nuke the offending
POJOs/methods in my backend's copy.
On a related note, many of the offending tests could be altered in such
a way that the resulting schema is acceptable to cassandra, which would
largely sidestep the issue but alter the test semantics. In many
instances I suspect the semantic in question is one that's not critical
to the test's intent, but I may be wrong.
Essentially cassandra uses what a relational db would call 'index
organized tables', i.e. the on-disk layout of data is a function of the
table's key. As a result, it's not possible to declare tables without a
primary key. Such mappings result from collections with bag semantics,
such as @OneToMany List<Object>, since the list may have dups. Removing
the bag semantics such as by adding an index column, avoids this issue.
But then you're testing something different...
Any preference on the approach to changing the test suite?
Jonathan.
--
Registered in England and Wales under Company Registration No. 03798903
Directors: Michael Cunningham (USA), Matt Parson
(USA), Charlie Peters (USA), Michael O'Neill(Ireland)
9 years
Adding a custom table to the user defined mapping
by Sanne Grinovero
Hi all,
I'm considering solving a complex issue in Hibernate Search by having
it add a couple of "system entities" to the set of user defined
entities.
Do we have any example on how I'd do that?
Bonus brownies if we could figure out a way to mark these as
"internal".. i.e. it would be nice to not allow user code to load
these, have other entities relate to these, or mention them in HQL
queries.
I'd need a backdoor to allow Search code to do that though :)
Of course I don't expect us to be able to hide the physical tables.
I guess I could get pretty far by using JDBC rather than defining it
as an entity, but I'd rather avoid that. If that were my only option,
I'd at least want to extend the schema generation/validation tasks to
include by custom table.
Thanks,
Sanne
9 years
OGM 5 Bootstrap: Reading property value in MetadataBuilderContributor
by Gunnar Morling
Steve, all,
For migrating OGM to the new ORM 5 bootstrap APIs, I am looking into using
a MetadataBuilderContributor for applying an OGM-specific
ImplicitNamingStrategy.
Provided it is exposed via META-INF/services, the contributor is run
un-conditionally. So I'd need a way to find out whether the passed
MetadataBuilder is meant to bootstrap Hibernate ORM or OGM.
If there is no way to do so (I couldn't find any), could the previously
applied configuration settings be exposed e.g. via
* an accessor MetadataBuilder#getSettings()
* or a new parameter on
MetadataBuilderContributor#contribute(MetadataBuilder b, Map<String,
Object> settings)
* or even MetadataBuilderContributor#contribute(MetadataBuilder b,
StandardServiceRegistry ssr)
?
Then I could make contribute() instantly return depending on some property
which is set before (we can do that for JPA in HibernateOgmPersistence,
OGM's PersistenceProvider, and in a custom ServiceRegistry factory for
non-JPA).
Thanks,
--Gunnar
9 years