anchor.diff:  == Testing in Java EE
   [[JUnit]]
   === JUnit
  -Unit testing projects that heavily use CDI (or other container services) is not recommended: if you really wish to test properly in isolation, you need to mock up injected services, which is a pain (see The https://antoniogoncalves.org/2012/11/27/launching-the-nomock-movement/[NoMock] Movement and this https://antoniogoncalves.org/2012/01/16/wytiwyr-what-you-test-is-what-you-run/[opinion] for further details).
  +Unit testing objects that heavily rely on CDI (or other container services) is not recommended: if you really wish to test properly in isolation, you need to mock up injected services, which is a pain (see The https://antoniogoncalves.org/2012/11/27/launching-the-nomock-movement/[NoMock] Movement and this https://antoniogoncalves.org/2012/01/16/wytiwyr-what-you-test-is-what-you-run/[opinion] for further details).
   
   [[Weld-SE]]
   === Weld SE
  
positive.code: 
  == JPA best practices
  === Use delimited identifiers
  Tell JPA to use delimited identifiers (see the object/relational xml mapping file, `orm.xml`, in the JPA samples). (See JSR 338 JPA 2.1 link:[spec], section 2.13.) JPA will then “delimit” (quote) all SQL identifiers, thus avoiding conflicts with e.g. table names that are also SQL keywords. Note that this render identifiers case sensitive. Delimited identifiers is off by default and may cause nasty problems, especially because SQL keywords differ by vendor (and it’s hard to keep track of all of them, see e.g. http://hsqldb.org/doc/guide/lists-app.html[here] or https://www.drupal.org/node/141051[here]). A typical problem with non delimited identifiers occurs when using an entity named `User`: this may work on some DBMS and fail at runtime on others.
  
  [[metamodel]]
  === Metamodel generator for typesafe JPA queries
  
negative.code: 
  * In Weld SE, the file `beans.xml` is required even for `annotated` bean discovery mode in implicit bean archives. “In general, an implicit bean archive does not have to contain a beans.xml descriptor. However, such a bean archive is not supported by Weld SE, i.e. it’s excluded from discovery.” — Weld doc http://docs.jboss.org/weld/reference/latest-master/en-US/html/environments.html#_implicit_bean_archive_support_2[Implicit Bean Archive Support in Java SE] (compare normal http://docs.jboss.org/weld/reference/latest-master/en-US/html/ee.html#packaging-and-deployment[Packaging and deployment]).
  * Weld SE has apparently a http://stackoverflow.com/a/30325614/859604[bug] that makes it fail to discover beans that are in different subtrees than the `beans.xml` file. Following best practices, the test files (including the `beans.xml` file, required only for Weld SE) should be in the `/src/test/` subfolders. But this would trigger the bug, Weld SE throwing exceptions of the kind `org.jboss.weld.exceptions.UnsatisfiedResolutionException: WELD-001334: Unsatisfied dependencies for type (…) with qualifiers (…)`. In `weld-se-wrong-annotated-build-discovery-mode`, I worked around the bug by moving a https://github.com/oliviercailloux/samples/tree/weld-se-wrong-annotated-build-discovery-mode/JavaEE-JPA-Inject-Servlets-JUnit/src/main/java/io/github/oliviercailloux/javaee_jpa_inject_servlets_junit/utils/ManagedReqScopeTester.java[class] and the https://github.com/oliviercailloux/samples/tree/weld-se-wrong-annotated-build-discovery-mode/JavaEE-JPA-Inject-Servlets-JUnit/src/main/resources/META-INF/beans.xml[`beans.xml`] file in `/src/main/`. This has another problem however: Weld SE is now a compile-time dependency (and can’t be restricted to `<scope>test</scope>`), thus, should be upgraded to a compilation-scoped dependency in the https://github.com/oliviercailloux/samples/tree/weld-se-wrong-annotated-build-discovery-mode/JavaEE-JPA-Inject-Servlets-JUnit/pom.xml[`pom`]. That would be asking for trouble when deploying the app.
  * Thus I gave up on `annotated` bean discovery mode, removed the `beans.xml` file, and used dynamic http://docs.jboss.org/weld/reference/latest-master/en-US/html/environments.html#_bootstrapping_cdi_se[explicit] bean declaration when link:JavaEE-JPA-Inject-Servlets-JUnit/src/test/java/io/github/oliviercailloux/javaee_jpa_inject_servlets_junit/utils/TestReqScopeInjection.java[instantiating] the container.
  * If you really want to go for testing using Weld SE, there’s ways to clean up the code a bit compared to this sample (I don’t believe this would be enough to really bring a satisfactory solution to the whole testing requirements, thus I stopped investigating, but I’m willing to hear from you if you manage to make it work in a clean way). Check out https://developer.jboss.org/wiki/CreatingUnitTestsWithWeldAndJunit4[Creating unit tests with Weld and Junit 4]. Also, other (better?) ways to manage the contexts exist, see http://docs.jboss.org/weld/reference/latest-master/en-US/html/contexts.html#_managing_the_built_in_contexts[Managing the built in contexts] in Weld doc; http://stackoverflow.com/questions/26631093/no-active-contexts-for-scope-type-javax-enterprise-context-requestscoped-when-in[SO].
  
  === Live server
  