Wojtek, you made my day. Dziękuję!
Paweł Od: Wojciech Żaboklicki <[email protected]> Do: [email protected] Data: 2016-05-10 21:20 Temat: Re: having problem with remove entity in data module Hi Pawel, Annotating EntityManagerProducer.create() with @RequestScoped will solve your problem. Kind regards, Wojtek > Wiadomość napisana przez [email protected] w dniu 10.05.2016, o godz. 17:40: > > Hi Team, > > Almost I succeeded to use data module except 'remove' method of my > repository. Having simple test: > > @org.junit.Test > public void test2(){ > Something something = new Something(); > something.setName( "Name" ); > somethingDao.save( something ); > log.info( something.getId() ); > somethingDao.remove( somethingDao.findBy( > something.getId() ) ); > } > > fails with > > test2(test.DeltaspikeTest) Time elapsed: 0.016 sec <<< ERROR! > org.apache.deltaspike.data.api.QueryInvocationException: Failed calling > Repository: > [Repository=pack1.SomethingDao,entity=pack1.Something,method=remove,exception=class > org.apache.deltaspike.data.api.QueryInvocationException,message=Failed > calling Repository: > [Repository=pack1.SomethingDao,entity=pack1.Something,method=remove,exception=class > org.apache.deltaspike.data.api.QueryInvocationException,message=Failed > calling Repository: > [Repository=pack1.SomethingDao,entity=pack1.Something,method=remove,exception=class > java.lang.reflect.InvocationTargetException,message=null > at test.DeltaspikeTest.test2(DeltaspikeTest.java:36) > Caused by: org.apache.deltaspike.data.api.QueryInvocationException: Failed > calling Repository: > [Repository=pack1.SomethingDao,entity=pack1.Something,method=remove,exception=class > org.apache.deltaspike.data.api.QueryInvocationException,message=Failed > calling Repository: > [Repository=pack1.SomethingDao,entity=pack1.Something,method=remove,exception=class > java.lang.reflect.InvocationTargetException,message=null > at test.DeltaspikeTest.test2(DeltaspikeTest.java:36) > Caused by: org.apache.deltaspike.data.api.QueryInvocationException: Failed > calling Repository: > [Repository=pack1.SomethingDao,entity=pack1.Something,method=remove,exception=class > java.lang.reflect.InvocationTargetException,message=null > at test.DeltaspikeTest.test2(DeltaspikeTest.java:36) > Caused by: java.lang.reflect.InvocationTargetException > at test.DeltaspikeTest.test2(DeltaspikeTest.java:36) > Caused by: java.lang.IllegalArgumentException: Entity must be managed to > call remove: Name, try merging the detached and try the remove again. > at test.DeltaspikeTest.test2(DeltaspikeTest.java:36) > > > For me it should obviously work. To regenerate the proble I made a GitHub > project : https://github.com/p4w3l/deltaspikeTest > > Simple call: mvn > > and you will see > > best regards > Paweł
