-
Dec 29th, 2011, 07:52 AM
#1
Upgraded to RC1 error gives following error java.lang.IllegalArgumentException
I have 3 concrete classes that implement an interface Profile.
I'm extending the CrudRepository to create my CRUD methods
public interface ProfileDAO extends CrudRepository<Profile, ObjectId>{
List<Profile> findByUserId(ObjectId userId);
}
This all works fine and persists objects to the database.
When using version M4 I can retrieve the collection of Profiles as interfaces
When I use version RC1 I get the following
java.lang.IllegalArgumentException: No property userId found on com.ulocusme.platform.user.profile.Profile!
at org.springframework.data.mapping.context.AbstractM appingContext.getPersistentPropertyPath(AbstractMa ppingContext.java:182)
at org.springframework.data.mongodb.repository.query. MongoQueryCreator.create(MongoQueryCreator.java:10 1)
at org.springframework.data.mongodb.repository.query. MongoQueryCreator.create(MongoQueryCreator.java:48 )
at org.springframework.data.repository.query.parser.A bstractQueryCreator.createCriteria(AbstractQueryCr eator.java:109)
at org.springframework.data.repository.query.parser.A bstractQueryCreator.createQuery(AbstractQueryCreat or.java:88)
at org.springframework.data.repository.query.parser.A bstractQueryCreator.createQuery(AbstractQueryCreat or.java:73)
at org.springframework.data.mongodb.repository.query. PartTreeMongoQuery.createQuery(PartTreeMongoQuery. java:70)
at org.springframework.data.mongodb.repository.query. AbstractMongoQuery.execute(AbstractMongoQuery.java :82)
at org.springframework.data.repository.core.support.R epositoryFactorySupport$QueryExecutorMethodInterce ptor.invoke(RepositoryFactorySupport.java:301)
at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :172)
at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:202)
at $Proxy14.findByUserId(Unknown Source)
at com.ulocusme.platform.business.service.impl.Profil eServiceImpl.getProfileByUser(ProfileServiceImpl.j ava:124)
at com.ulocusme.platform.business.service.ProfileServ iceTest.testGetUserProfiles(ProfileServiceTest.jav a:50)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at junit.framework.TestCase.runTest(TestCase.java:168 )
at junit.framework.TestCase.runBare(TestCase.java:134 )
at org.springframework.test.ConditionalTestCase.runBa re(ConditionalTestCase.java:79)
at junit.framework.TestResult$1.protect(TestResult.ja va:110)
at junit.framework.TestResult.runProtected(TestResult .java:128)
at junit.framework.TestResult.run(TestResult.java:113 )
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:2 43)
at junit.framework.TestSuite.run(TestSuite.java:238)
at org.junit.internal.runners.JUnit38ClassRunner.run( JUnit38ClassRunner.java:83)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestR eference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecutio n.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.main(RemoteTestRunner.java:197)
-
Jan 12th, 2012, 06:26 AM
#2
That shouldn't have ever worked at all actually. Currently the domain class for the repository has to contain the id property at least which an interface by definition can't. Would you mind pasting the Profile interface? Is there a chance you can make it an abstract class containing the id property? If you want to keep track of support for interfaces as repository root types feel free to vote for [0].
[0] https://jira.springsource.org/browse/DATAMONGO-131
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules