Jpa
Jpa ,jpa,Jpa,</p:column> </p:row> <p:row> <p:column> <h:outputLabel styleClass="label" for="idService" value="Service :" /> </p:column>
</p:column>
</p:row>
<p:row>
<p:column>
<h:outputLabel styleClass="label" for="idService" value="Service :" />
</p:column>
<p:column>
</p:column>
</p:row>
<p:row>
<p:column>
<h:outputLabel styleClass="label" for="idService" value="Service :" />
</p:column>
<p:column>
</p:column>
</p:row>
<p:row>
<p:column colspan="2"> </p:column>
</p:row>
<p:row>
<p:column colspan="2">
<p:commandButton update=":form2" value="Ajouter / Modifier la fonction" actionListener="#{fonctionCtrl.createPerson}" icon="ui-icon-disk" />
<p:commandButton update=":form2" value="Supprimer fonction" actionListener="#{fonctionCtrl.deletePerson}" icon="ui-icon-trash" />
</p:column>
</p:row>
</p:panelGrid>
</h:form>
</p:fieldset>
<br/>
<p:fieldset legend="Liste des fonctions" id="fonctionsList" style="width:850px" toggleable="true">
<h:form style="border:none" id="form2">
<p:outputPanel>
<p:dataTable id="fonctionsTable" var="bean" value="#{fonctionCtrl.fonctions}" resizableColumns="true" rows="50"
scrollable="true" scrollHeight="200" rowKey="#{bean.codeFonction}"
selection="#{fonctionBean.selectedFonction}" selectionMode="single">
<p:column headerText="Code" width="70" sortBy="#{bean.codeFonction}">
<h:outputText value="#{bean.codeFonction}" />
</p:column>
<p:column headerText="Libellé " width="200" sortBy="#{bean.libelleFonction}">
<h:outputText value="#{bean.libelleFonction}"/>
</p:column>
<p:column headerText="Commentaire">
<h:outputText value="#{bean.commentaireFonction}"/>
</p:column>
<p:column headerText="Service">
<h:outputText value="#{bean.idService}"/>
</p:column>
</p:column>
</p:row>
<p:row>
<p:column>
<h:outputLabel styleClass="label" for="idService" value="Service :" />
</p:column>
<p:column>
请尝试帮助我。我想问题的根本原因与
功能
实体定义有关,因为它会生成两个同名的idService
列:
</p:column>
</p:row>
<p:row>
<p:column>
<h:outputLabel styleClass="label" for="idService" value="Service :" />
</p:column>
<p:column>
public class Fonction implements Serializable {
@Column(name="\"idService\"") // the primary key
private Integer idService;
@ManyToOne
@JoinColumn(name="\"idService\"") //the foreign key related to Service
private Service service;
}
因此,行插入失败。尝试重命名其中一个键列,即
</p:column>
</p:row>
<p:row>
<p:column>
<h:outputLabel styleClass="label" for="idService" value="Service :" />
</p:column>
<p:column>
@Column(name="\"idFonction\"") // the primary key
private Integer idFonction;
@Column(name="\"idFonction\"") // the primary key
private Integer idFonction;