I get a NullPointerException when I try to use @OneToMany on a Map collection, example:
@OneToMany(orphanRemoval = true, cascade = CascadeType.ALL, fetch = FetchType.EAGER) @MapKey(name = "ref") private Map<String, Property> properties;
java.lang.NullPointerException: null at org.bson.BasicBSONEncoder._putObjectField(BasicBSONEncoder.java:200) ~[mongo-java-driver-2.10.1.jar:na] at org.bson.BasicBSONEncoder.putObject(BasicBSONEncoder.java:174) ~[mongo-java-driver-2.10.1.jar:na] at org.bson.BasicBSONEncoder._putObjectField(BasicBSONEncoder.java:226) ~[mongo-java-driver-2.10.1.jar:na] at org.bson.BasicBSONEncoder.putIterable(BasicBSONEncoder.java:295) ~[mongo-java-driver-2.10.1.jar:na] at org.bson.BasicBSONEncoder._putObjectField(BasicBSONEncoder.java:234) ~[mongo-java-driver-2.10.1.jar:na] at org.bson.BasicBSONEncoder.putObject(BasicBSONEncoder.java:174) ~[mongo-java-driver-2.10.1.jar:na] at org.bson.BasicBSONEncoder._putObjectField(BasicBSONEncoder.java:226) ~[mongo-java-driver-2.10.1.jar:na] at org.bson.BasicBSONEncoder.putObject(BasicBSONEncoder.java:174) ~[mongo-java-driver-2.10.1.jar:na] at org.bson.BasicBSONEncoder.putObject(BasicBSONEncoder.java:120) ~[mongo-java-driver-2.10.1.jar:na] at com.mongodb.DefaultDBEncoder.writeObject(DefaultDBEncoder.java:27) ~[mongo-java-driver-2.10.1.jar:na] at com.mongodb.OutMessage.putObject(OutMessage.java:289) ~[mongo-java-driver-2.10.1.jar:na] at com.mongodb.OutMessage.writeUpdate(OutMessage.java:175) ~[mongo-java-driver-2.10.1.jar:na] at com.mongodb.OutMessage.update(OutMessage.java:62) ~[mongo-java-driver-2.10.1.jar:na] at com.mongodb.DBApiLayer$MyCollection.update(DBApiLayer.java:347) ~[mongo-java-driver-2.10.1.jar:na] at com.mongodb.DBCollection.update(DBCollection.java:177) ~[mongo-java-driver-2.10.1.jar:na] at org.hibernate.ogm.datastore.mongodb.MongoDBDialect.updateAssociation(MongoDBDialect.java:506) ~[hibernate-ogm-mongodb-4.1.0.Beta5.jar:4.1.0.Beta5] at org.hibernate.ogm.dialect.BatchOperationsDelegator.updateAssociation(BatchOperationsDelegator.java:140) ~[hibernate-ogm-core-4.1.0.Beta5.jar:4.1.0.Beta5] at org.hibernate.ogm.util.impl.AssociationPersister.flushToCache(AssociationPersister.java:367) ~[hibernate-ogm-core-4.1.0.Beta5.jar:4.1.0.Beta5] at org.hibernate.ogm.persister.OgmCollectionPersister.recreate(OgmCollectionPersister.java:565) ~[hibernate-ogm-core-4.1.0.Beta5.jar:4.1.0.Beta5] at org.hibernate.action.internal.CollectionRecreateAction.execute(CollectionRecreateAction.java:67) ~[hibernate-core-4.3.5.Final.jar:4.3.5.Final] at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:463) ~[hibernate-core-4.3.5.Final.jar:4.3.5.Final] at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:349) ~[hibernate-core-4.3.5.Final.jar:4.3.5.Final] at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:350) ~[hibernate-core-4.3.5.Final.jar:4.3.5.Final] at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:56) ~[hibernate-core-4.3.5.Final.jar:4.3.5.Final] at org.hibernate.ogm.service.impl.FlushBatchManagerEventListener.delegate(FlushBatchManagerEventListener.java:34) ~[hibernate-ogm-core-4.1.0.Beta5.jar:4.1.0.Beta5] at org.hibernate.ogm.service.impl.FlushBatchManagerEventListener.delegate(FlushBatchManagerEventListener.java:21) ~[hibernate-ogm-core-4.1.0.Beta5.jar:4.1.0.Beta5] at org.hibernate.ogm.service.impl.BatchManagerEventListener.onEvent(BatchManagerEventListener.java:41) ~[hibernate-ogm-core-4.1.0.Beta5.jar:4.1.0.Beta5] at org.hibernate.ogm.service.impl.FlushBatchManagerEventListener.onFlush(FlushBatchManagerEventListener.java:29) ~[hibernate-ogm-core-4.1.0.Beta5.jar:4.1.0.Beta5] at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1222) ~[hibernate-core-4.3.5.Final.jar:4.3.5.Final] at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:425) ~[hibernate-core-4.3.5.Final.jar:4.3.5.Final] at org.hibernate.engine.transaction.synchronization.internal.SynchronizationCallbackCoordinatorNonTrackingImpl.beforeCompletion(SynchronizationCallbackCoordinatorNonTrackingImpl.java:110) ~[hibernate-core-4.3.5.Final.jar:4.3.5.Final] at org.hibernate.engine.transaction.synchronization.internal.RegisteredSynchronization.beforeCompletion(RegisteredSynchronization.java:50) ~[hibernate-core-4.3.5.Final.jar:4.3.5.Final] at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:76) ~[jbossjta-4.16.6.Final.jar:na] at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:273) ~[jbossjta-4.16.6.Final.jar:na] at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:93) ~[jbossjta-4.16.6.Final.jar:na] at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:164) ~[jbossjta-4.16.6.Final.jar:na] at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1165) ~[jbossjta-4.16.6.Final.jar:na] at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:117) [jbossjta-4.16.6.Final.jar:na] at org.springframework.transaction.jta.JtaTransactionManager.doCommit(JtaTransactionManager.java:1021) [spring-tx-4.0.0.RELEASE.jar:4.0.0.RELEASE] at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:757) [spring-tx-4.0.0.RELEASE.jar:4.0.0.RELEASE] at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:726) [spring-tx-4.0.0.RELEASE.jar:4.0.0.RELEASE] at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:478) [spring-tx-4.0.0.RELEASE.jar:4.0.0.RELEASE] at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:272) [spring-tx-4.0.0.RELEASE.jar:4.0.0.RELEASE] at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95) [spring-tx-4.0.0.RELEASE.jar:4.0.0.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) [spring-aop-4.0.0.RELEASE.jar:4.0.0.RELEASE] at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:646) [spring-aop-4.0.0.RELEASE.jar:4.0.0.RELEASE] at com.eapps.esite.core.services.PropertiesService$$EnhancerByCGLIB$$8100c76c.save(<generated>) [spring-core-4.0.0.RELEASE.jar:na] at com.eapps.esite.core.services.PropertiesServiceTest.testGetProperties(PropertiesServiceTest.java:40) [test-classes/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_45] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_45] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_45] at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_45] at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45) [junit-4.10.jar:na] at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) [junit-4.10.jar:na] at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42) [junit-4.10.jar:na] at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) [junit-4.10.jar:na] at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) [junit-4.10.jar:na] at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74) [spring-test-4.0.0.RELEASE.jar:4.0.0.RELEASE] at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83) [spring-test-4.0.0.RELEASE.jar:4.0.0.RELEASE] at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72) [spring-test-4.0.0.RELEASE.jar:4.0.0.RELEASE] at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:232) [spring-test-4.0.0.RELEASE.jar:4.0.0.RELEASE] at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:89) [spring-test-4.0.0.RELEASE.jar:4.0.0.RELEASE] at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) [junit-4.10.jar:na] at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60) [junit-4.10.jar:na] at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) [junit-4.10.jar:na] at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) [junit-4.10.jar:na] at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222) [junit-4.10.jar:na] at
org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) [spring-test-4.0.0.RELEASE.jar:4.0.0.RELEASE] at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71) [spring-test-4.0.0.RELEASE.jar:4.0.0.RELEASE] at org.junit.runners.ParentRunner.run(ParentRunner.java:300) [junit-4.10.jar:na] at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:175) [spring-test-4.0.0.RELEASE.jar:4.0.0.RELEASE] at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) [.cp/:na] at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) [.cp/:na] at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) [.cp/:na] at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) [.cp/:na] at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) [.cp/:na] at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) [.cp/:na]
|