You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltaspike.apache.org by "kingli (JIRA)" <ji...@apache.org> on 2014/08/08 12:09:15 UTC

[jira] [Created] (DELTASPIKE-683) user criteria() error

kingli created DELTASPIKE-683:
---------------------------------

             Summary: user  criteria() error
                 Key: DELTASPIKE-683
                 URL: https://issues.apache.org/jira/browse/DELTASPIKE-683
             Project: DeltaSpike
          Issue Type: Bug
          Components: Data-Module
    Affects Versions: 1.0.1, 1.0.2
         Environment: ds1.0 jdk1.7 
            Reporter: kingli
             Fix For: 1.0.1


Use the following code, this method throws an exception
@Test
    public void injectionTest(){
    	personRepository.searchAll("king8");
    }

@Repository(forEntity = Person.class)
public abstract class PersonRepository extends BaseRepository<Person, Long> implements IPersonRepository {
	@Override
	public List<Person> searchAll(String v) {
		Criteria<Person, Person> c = criteria();
		c.eq(Person_.name,"king");
        return c.getResultList();
    }
}
八月 08, 2014 6:00:23 下午 org.apache.deltaspike.data.impl.criteria.QueryCriteria createQuery
严重: Exception while creating JPA query
java.lang.NullPointerException
	at org.hibernate.ejb.criteria.path.AbstractPathImpl.get(AbstractPathImpl.java:146)
	at org.apache.deltaspike.data.impl.criteria.predicate.Eq.build(Eq.java:40)
	at org.apache.deltaspike.data.impl.criteria.QueryCriteria.predicates(QueryCriteria.java:283)
	at org.apache.deltaspike.data.impl.criteria.QueryCriteria.createQuery(QueryCriteria.java:147)
	at org.apache.deltaspike.data.impl.criteria.QueryCriteria.getResultList(QueryCriteria.java:106)
	at com.lhl.common.biz.dictionary.repo.PersonRepository.searchAll(PersonRepository.java:19)
	at com.lhl.common.biz.dictionary.repo.PersonRepository_$$_javassist_0._d71searchAll(PersonRepository_$$_javassist_0.java)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.apache.deltaspike.partialbean.impl.PartialBeanAbstractMethodHandler.invoke(PartialBeanAbstractMethodHandler.java:42)
	at org.apache.deltaspike.partialbean.impl.MethodHandlerProxy.invoke(MethodHandlerProxy.java:35)
	at com.sun.proxy.$Proxy72.invoke(Unknown Source)
	at com.lhl.common.biz.dictionary.repo.PersonRepository_$$_javassist_0.searchAll(PersonRepository_$$_javassist_0.java)
	at com.lhl.common.biz.dictionary.repo.PersonTest.injectionTest(PersonTest.java:38)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
	at org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner$ContainerAwareMethodInvoker.invokeMethod(CdiTestRunner.java:335)
	at org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner$ContainerAwareMethodInvoker.evaluate(CdiTestRunner.java:307)
	at org.apache.deltaspike.testcontrol.impl.transaction.TransactionStatementDecoratorFactory$TransactionAwareRunAfters.evaluate(TransactionStatementDecoratorFactory.java:91)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
	at org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner.runChild(CdiTestRunner.java:169)
	at org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner.runChild(CdiTestRunner.java:67)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
	at org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner$BeforeClassStatement.evaluate(CdiTestRunner.java:361)
	at org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner$AfterClassStatement.evaluate(CdiTestRunner.java:387)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
	at org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner.run(CdiTestRunner.java:136)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

Use the following code, this method can correctly use.
The findAll () method from EntityRepository
@Test
    public void injectionTest(){
    	personRepository.findAll();
    	personRepository.searchAll("king8");
    }




--
This message was sent by Atlassian JIRA
(v6.2#6252)