Hibernate OGM for MongoDB

Hibernate OGM for MongoDB

Hibernate OGM for MongoDB

So lately I’ve been playing with Hibernate OGM MongoDB’s latest version 5.4.0.Beta2 but I’m not able to run a demo project created from wildfly-javaee7-war archetype following the documentation.

Here are the changes I’ve made to make it run the Arquillian test:

public static Archive createTestArchive() {
 String manifest = Descriptors.create(ManifestDescriptor.class).attribute("Dependencies", "org.hibernate.ogm:5.4 services, org.hibernate.ogm.mongodb:5.4 services")

 return ShrinkWrap.create(WebArchive.class, "test.war") //
   .addClasses(Member.class, MemberRegistration.class, Resources.class) //
   .addAsResource(new StringAsset(manifest), "META-INF/MANIFEST.MF") //
   .addAsResource("META-INF/test-persistence.xml", "META-INF/persistence.xml") //
   // doesn't work on this version
//    .addAsResource("jboss-deployment-structure.xml", "WEB-INF/jboss-deployment-structure.xml") //
   .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml") //
   // Deploy our test datasource

Notice that instead of using jboss-deployment-structure file, we use a manifest. Maybe it’s a bug in the release.

You can download the complete source code from:

  • https://github.com/czetsuya/Hibernate-OGM-MongoDB-Demo

Leave a Reply