リポジトリに含まれているクエリの行数を表示しようとしています。ここ はリポジトリである:ここではEntityManager Apache Deltaspikeが見つかりません
@Repository
public interface TagRepository extends EntityRepository<Tag, Long> {
/**
* @param //
* @return all Tag matched
*/
@Query("SELECT * FROM Tag") //TESTED
List<Tag> findByDefault();
}
は私のコントローラである:ここでは
@Named
@ViewScoped
public class ControllerTest implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
@Inject
private TagRepository tagRepository;
public ControllerTest()
{
super();
}
public Integer compte()
{
return tagRepository.findByDefault().size();
}
public String essai()
{
String message = "Hello World !";
return message;
}
}
は私* .xhtmlファイルです:
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ds="http://deltaspike.apache.org/jsf"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:rich="http://richfaces.org/rich" template="/layout/template.xhtml"
xmlns:a4j="http://richfaces.org/a4j">
<ui:define name="body">
<rich:collapsiblePanel switchType="client" opened="false" label="Updates version 2.2.7">
<h:outputText
value="#{controllerTest.compte()}">
</h:outputText>
<h:outputText
value="#{controllerTest.essai()}">
</h:outputText>
<h:outputText
value="Hello world !">
</h:outputText>
</rich:collapsiblePanel>
</ui:define>
レイアウトはと完全に動作します方法essai()
しかし、私は方法を使用するときcompte()
:
javax.servlet.ServletException: Exception calling Repository: [Repository=class repositories.TagRepository$$DSPartialBeanProxy,method=findByDefault],exception=class java.lang.IllegalStateException,message=Could not find EntityManager with default qualifier.
Apache Deltaspikeはアノテーションを使用してBeanを独自に管理することができましたが、
質問は: この問題の原因はどこですか?それは私のリポジトリですか?私は何か見落としてますか ? 私はまだこれを探検していますが、Apache Deltaspikeの場合は何も見つかりません。
私はWildfly 10.0.0、Hibernate 5.4.1、Eclipse Neon、RichFaces 4.X、JSF 2.X、Apache Deltaspike 1.7.2を使用します。
ご回答いただきありがとうございます。
最後に、私は、EntityManagerを必要としませんでした。それは私の依存関係の間の葛藤でした。スコープは自動的にBeanを提供します。どうもありがとう ! – rbcvlr