Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring Ektorp ArrayList在PrimeFaces列表组件的JSF中获取全部_Spring_Jsf_Primefaces_Couchdb_Ektorp - Fatal编程技术网

Spring Ektorp ArrayList在PrimeFaces列表组件的JSF中获取全部

Spring Ektorp ArrayList在PrimeFaces列表组件的JSF中获取全部,spring,jsf,primefaces,couchdb,ektorp,Spring,Jsf,Primefaces,Couchdb,Ektorp,如何通过Ektorp API从CouchDB获取现有锦标赛的列表?我的代码如下所示: 非常感谢 我在TourneyService类中调用methode getAll(),getAll()是Tourneys的列表 //旅游服务 @Service public class TourneyService implements Serializable{ private static final long serialVersionUID = 699617628013084160L; @Autowi

如何通过Ektorp API从CouchDB获取现有锦标赛的列表?我的代码如下所示:

非常感谢

我在TourneyService类中调用methode getAll(),getAll()是Tourneys的列表

//旅游服务

@Service
public class TourneyService implements Serializable{

private static final long serialVersionUID = 699617628013084160L;

@Autowired
private TourneyRepository tourneyRepository;

public List<Tourney> getAllTourneys(){
    return tourneyRepository.getAll();
}
}

@GenerateView具有以下约束:

  • 该方法必须命名为findBy[Property]。如果定义了@TypeDiscriminator,则还可以生成getAll方法使用的“all”视图
  • 该方法只能有一个参数
  • 该属性必须存在于目标类中
验证您的Tourney类中是否有@TypeDiscriminator

@Component
public class TourneyRepository extends CouchDbRepositorySupport<Tourney> {

@Autowired
public TourneyRepository(@Qualifier("cegocouchdb") CouchDbConnector db) {
    super(Tourney.class, db);
    initStandardDesignDocument();
}

@GenerateView @Override
public List<Tourney> getAll() {
    ViewQuery q = createQuery("all")
                    .descending(true)
                    .includeDocs(true);
    return db.queryView(q, Tourney.class);
}

   }
    @ManagedBean(name = "TourneyListMmgtBean")
    @RequestScoped
    public class TourneyListBean implements Serializable {

private static final long serialVersionUID = 6130842812974474768L;

@ManagedProperty(value = "#{tourneyService}")
private TourneyService tourneyService;

private List<Tourney> tourneys; 

public void onEdit(RowEditEvent event) {
    FacesMessage msg = new FacesMessage("Tourney changed", "");

    FacesContext.getCurrentInstance().addMessage(null, msg);
}

public void onCancel(RowEditEvent event) {
    FacesMessage msg = new FacesMessage("Aktion abgebrochen", "");

    FacesContext.getCurrentInstance().addMessage(null, msg);
}


public TourneyService getTourneyService() {
    return tourneyService;
}

public void setTourneyService(TourneyService tourneyService) {
    this.tourneyService = tourneyService;
}

public List<Tourney> getTourneys() {
    tourneys = tourneyService.getAllTourneys();
    if (tourneys == null) {
        tourneys = new ArrayList<Tourney>();
    }
    return tourneys;
}

public void setTourneys(List<Tourney> torneys) {
    this.tourneys = torneys;
}
   }
<ui:define name="content">



    <h:form id="form">

        <p:growl id="messages" showDetail="true" />

        <p:dataTable var="tourney" value="#{TourneyListMmgtBean.tourneys}"
            id="tourneyList" editable="true">

            <f:facet name="header">  
        In-Cell Editing  
    </f:facet>

            <p:ajax event="rowEdit" listener="#{TourneyListMmgtBean.onEdit}"
                update=":form:messages" />
            <p:ajax event="rowEditCancel"
                listener="#{TourneyListMmgtBean.onCancel}" update=":form:messages" />

            <p:column headerText="Turniername" style="width:30%">
                <p:cellEditor>
                    <f:facet name="output">
                        <h:outputText value="#{tourney.name}" />
                    </f:facet>
                    <f:facet name="input">
                        <p:inputText value="#{tourney.name}" style="width:100%"
                            label="Turniername" />
                    </f:facet>
                </p:cellEditor>
            </p:column>

            <p:column headerText="Straße" style="width:20%">
                <p:cellEditor>
                    <f:facet name="output">
                        <h:outputText value="#{tourney.street}" />
                    </f:facet>
                    <f:facet name="input">
                        <p:inputText value="#{tourney.street}" style="width:100%"
                            label="Straße" />
                    </f:facet>
                </p:cellEditor>
            </p:column>

            <p:column headerText="Turnierstadt" style="width:24%">
                <p:cellEditor>
                    <f:facet name="output">
                        <h:outputText value="#{tourney.city}" />
                    </f:facet>
                    <f:facet name="input">
                        <p:inputText value="#{tourney.city}" style="width:100%"
                            label="Turnierstadt" />
                    </f:facet>
                </p:cellEditor>
            </p:column>

            <p:column headerText="Beginnzeit" style="width:24%">
                <p:cellEditor>
                    <f:facet name="output">
                        <h:outputText value="#{tourney.beginTime}" />
                    </f:facet>
                    <f:facet name="input">
                        <p:inputText value="#{tourney.beginTime}" style="width:100%"
                            label="Beginnzeit" />
                    </f:facet>
                </p:cellEditor>
            </p:column>

            <p:column headerText="Endzeit" style="width:24%">
                <p:cellEditor>
                    <f:facet name="output">
                        <h:outputText value="#{tourney.endTime}" />
                    </f:facet>
                    <f:facet name="input">
                        <p:inputText value="#{tourney.endTime}" style="width:100%"
                            label="Endzeit" />
                    </f:facet>
                </p:cellEditor>
            </p:column>

            <p:column headerText="Turnierpunkte" style="width:24%">
                <p:cellEditor>
                    <f:facet name="output">
                        <h:outputText value="#{tourney.points}" />
                    </f:facet>
                    <f:facet name="input">
                        <p:inputText value="#{tourney.points}" style="width:100%"
                            label="Turnierpunkte" />
                    </f:facet>
                </p:cellEditor>
            </p:column>

            <p:column style="width:6%">
                <p:rowEditor />
            </p:column>

        </p:dataTable>

    </h:form>

</ui:define>
org.ektorp.support.ViewGenerationException: Cannot generate 'all' view for null.