SourceForge.net Logo
Main Overview Wiki Issues Forum Build Fisheye
Issue Details (XML | Word | Printable)

Key: CMP-354
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Shay Banon
Reporter: Ismael Juma
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Compass

Compass fails to add Id field with supportUnmarshall=false under some circumstances.

Created: 09/Jan/07 04:19 PM   Updated: 07/Feb/07 05:13 AM
Component/s: Compass::Core
Affects Version/s: 1.1 M3
Fix Version/s: 1.1 RC1

File Attachments: 1. Zip Archive compass-testcase.zip (5 kB)

Environment: JDK 6, Linux 2.6.19


 Description  « Hide
Compass fails to add Id field in some circumstances. I am attaching a test case that shows the problem. However, I am unsure if this will work on your machine, it's basically dependent on the order that the mappings are processed, which in turn is dependent on the order that the mappings are inserted, which in turn is dependent on their location in the HashMap where the annotations are inserted after they're processed by the java libraries.

The problem will only occur if the @SearchableComponent in Business is the first element to be processed. The investigation I did seems to indicate that context.setAttribute(DISABLE_INTERNAL_MAPPINGS, DISABLE_INTERNAL_MAPPINGS_MARK) in ClassMappingConverter
ends up being called as part of the processing of of that @SearchableComponent and it never gets unset. As a result, the insertion of the Id for Business gets skipped. The end result is that I get the following exception.

org.compass.gps.device.jpa.JpaGpsDeviceException: Failed while creating [org.compass.core.test.Business@d71194d]; nested exception is org.compass.core.engine.SearchEngineException: Id with path [$/Business/code] for alias [Business] not found
org.compass.core.engine.SearchEngineException: Id with path [$/Business/code] for alias [Business] not found
at org.compass.core.engine.utils.ResourceHelper.toIds(ResourceHelper.java:76)
at org.compass.core.engine.utils.ResourceHelper.toIds(ResourceHelper.java:58)
at org.compass.core.spi.ResourceKey.<init>(ResourceKey.java:40)
at org.compass.core.lucene.LuceneResource.resourceKey(LuceneResource.java:111)
at org.compass.core.lucene.engine.transaction.ReadCommittedTransaction.doCreate(ReadCommittedTransaction.java:314)
at org.compass.core.lucene.engine.transaction.AbstractTransaction.create(AbstractTransaction.java:109)
at org.compass.core.lucene.engine.LuceneSearchEngine.create(LuceneSearchEngine.java:330)
at org.compass.core.impl.DefaultCompassSession.create(DefaultCompassSession.java:288)
at org.compass.gps.device.jpa.AbstractCompassJpaEntityListener$1.doInCompassWithoutResult(AbstractCompassJpaEntityListener.java:108)
at org.compass.core.CompassCallbackWithoutResult.doInCompass(CompassCallbackWithoutResult.java:29)
at org.compass.core.CompassTemplate.execute(CompassTemplate.java:134)
at org.compass.core.CompassTemplate.execute(CompassTemplate.java:117)
at org.compass.gps.device.jpa.AbstractCompassJpaEntityListener.postPersist(AbstractCompassJpaEntityListener.java:106)
at org.compass.gps.device.jpa.lifecycle.TopLinkEssentialsJpaEntityLifecycleInjector$TopLinkEssentialsEventListener.postInsert(TopLinkEssentialsJpaEntityLifecycleInjector.java:47)
at oracle.toplink.essentials.descriptors.DescriptorEventManager.notifyListener(DescriptorEventManager.java:628)
at oracle.toplink.essentials.descriptors.DescriptorEventManager.notifyListeners(DescriptorEventManager.java:679)
at oracle.toplink.essentials.descriptors.DescriptorEventManager.executeEvent(DescriptorEventManager.java:198)
at oracle.toplink.essentials.internal.queryframework.DatabaseQueryMechanism.insertObjectForWrite(DatabaseQueryMechanism.java:476)
at oracle.toplink.essentials.queryframework.InsertObjectQuery.executeCommit(InsertObjectQuery.java:74)
at oracle.toplink.essentials.internal.queryframework.DatabaseQueryMechanism.performUserDefinedWrite(DatabaseQueryMechanism.java:635)
at oracle.toplink.essentials.internal.queryframework.DatabaseQueryMechanism.performUserDefinedInsert(DatabaseQueryMechanism.java:599)
at oracle.toplink.essentials.internal.queryframework.DatabaseQueryMechanism.insertObjectForWriteWithChangeSet(DatabaseQueryMechanism.java:495)
at oracle.toplink.essentials.queryframework.WriteObjectQuery.executeCommitWithChangeSet(WriteObjectQuery.java:130)
at oracle.toplink.essentials.internal.queryframework.DatabaseQueryMechanism.executeWriteWithChangeSet(DatabaseQueryMechanism.java:283)
at oracle.toplink.essentials.queryframework.WriteObjectQuery.executeDatabaseQuery(WriteObjectQuery.java:67)
at oracle.toplink.essentials.queryframework.DatabaseQuery.execute(DatabaseQuery.java:609)
at oracle.toplink.essentials.queryframework.DatabaseQuery.executeInUnitOfWork(DatabaseQuery.java:536)
at oracle.toplink.essentials.queryframework.ObjectLevelModifyQuery.executeInUnitOfWorkObjectLevelModifyQuery(ObjectLevelModifyQuery.java:123)
at oracle.toplink.essentials.queryframework.ObjectLevelModifyQuery.executeInUnitOfWork(ObjectLevelModifyQuery.java:95)
at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2219)
at oracle.toplink.essentials.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:937)
at oracle.toplink.essentials.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:894)
at oracle.toplink.essentials.internal.sessions.CommitManager.commitNewObjectsForClassWithChangeSet(CommitManager.java:254)
at oracle.toplink.essentials.internal.sessions.CommitManager.commitAllObjectsForClassWithChangeSet(CommitManager.java:231)
at oracle.toplink.essentials.internal.sessions.CommitManager.commitAllObjectsWithChangeSet(CommitManager.java:187)
at oracle.toplink.essentials.internal.sessions.AbstractSession.writeAllObjectsWithChangeSet(AbstractSession.java:2638)
at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.commitToDatabase(UnitOfWorkImpl.java:1030)
at oracle.toplink.essentials.internal.ejb.cmp3.base.RepeatableWriteUnitOfWork.commitToDatabase(RepeatableWriteUnitOfWork.java:357)
at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.commitToDatabaseWithPreBuiltChangeSet(UnitOfWorkImpl.java:1146)
at oracle.toplink.essentials.internal.ejb.cmp3.base.RepeatableWriteUnitOfWork.writeChanges(RepeatableWriteUnitOfWork.java:235)
at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerImpl.flush(EntityManagerImpl.java:314)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:176)
at $Proxy17.flush(Unknown Source)
at org.compass.core.test.CompassTest.testCompass(CompassTest.java:18)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:69)
at org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.access$001(AbstractAnnotationAwareTransactionalTests.java:44)
at org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests$1.run(AbstractAnnotationAwareTransactionalTests.java:112)
at org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.runTest(AbstractAnnotationAwareTransactionalTests.java:177)
at org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.runTestTimed(AbstractAnnotationAwareTransactionalTests.java:150)
at org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.runBare(AbstractAnnotationAwareTransactionalTests.java:108)
at org.springframework.test.jpa.AbstractJpaTests.runBare(AbstractJpaTests.java:160)
at org.springframework.test.jpa.AbstractJpaTests.runBare(AbstractJpaTests.java:239)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

Hopefully this (along with the test case) is enough information for you to figure out where things go wrong.



 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Ismael Juma added a comment - 09/Jan/07 04:22 PM
A test case that shows the bug when tested against SVN revision 1705.

Ismael Juma added a comment - 12/Jan/07 08:09 AM
Thanks. I downloaded the new snapshot and it fixes the issues I was having. Feel free to close this bug.