0
votes

Consider code bellow

Beneficiaire class :

@Entity
@Table(uniqueConstraints=
@UniqueConstraint(name="u_benef_noBenef", columnNames="noBenef"))
public class Beneficiaire implements Serializable {

private static final long serialVersionUID = 1L;

@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private Integer idBenef;

@Column(nullable=false)
private Integer noApBenef;

@Column(nullable=false)
private Integer noBenef;

@Column(columnDefinition="character varying(100) not null")
private String nomBenef;

@DateTimeFormat(pattern="dd/MM/yyyy")
@Column(nullable=false)
private LocalDate dateNaissanceBenef;

@ManyToOne(cascade=CascadeType.ALL)
@JoinColumn(name="id_cat_beneficiaire",
            foreignKey=@ForeignKey(name="fk_benef_idCatBenef"),
            nullable=false)
private CategorieBeneficiaire categorieBeneficiaire;

@ManyToOne(cascade=CascadeType.ALL)
@JoinColumn(name="id_sexe",
            foreignKey=@ForeignKey(name="fk_benef_idSexe"),
            nullable=false)
private Sexe sexe;

@ManyToOne(cascade=CascadeType.ALL)
@JoinColumn(name="id_assure",
            foreignKey=@ForeignKey(name="fk_benef_idAssure"),
            nullable=false)
private Assure assure;

@ManyToOne(cascade=CascadeType.ALL)
@JoinColumn(name="id_attributaire",
            foreignKey=@ForeignKey(name="fk_benef_idAttrib"),
            nullable=false)
private Attributaire attributaire;

@ManyToOne(cascade=CascadeType.ALL)
@JoinColumn(name="id_prestation",
            foreignKey=@ForeignKey(name="fk_benef_idPrestation"),
            nullable=false)
private Prestation prestation;

@DateTimeFormat(pattern="dd/MM/yyyy")
@Column(nullable=false)
private LocalDate dateEffetPrestation;

@Column(precision=8, nullable=false) 
private BigDecimal mntMensuelPrestation;

private Integer trimestreDerniereEmission;

private Integer anneeDerniereEmission;

@Column(columnDefinition="integer default 1 not null", insertable=false)
private Integer estActifBenef;

@Column(columnDefinition="timestamp default current_timestamp not null", insertable=false)
private LocalDateTime dateheureCreationBenef;

@ManyToOne(cascade=CascadeType.ALL)
@JoinColumn(name="id_utilisateur",
        foreignKey=@ForeignKey(name="utilisateur_id_fk"),
        nullable=true)
private Utilisateur utilisateur;

/*@OneToMany(mappedBy="beneficiairePj", cascade=CascadeType.ALL, orphanRemoval=true)
private List<PieceJustificative> pieceJustificatives = new ArrayList<PieceJustificative>();*/



public Beneficiaire() {
    //For JPA
}


public Beneficiaire(Integer noBenef, String nomBenef, Integer noApBenef,
        CategorieBeneficiaire categorieBeneficiaire, Sexe sexe, Assure assure, Attributaire attributaire,
        Prestation prestation) {
    super();
    this.noBenef = noBenef;
    this.nomBenef = nomBenef;
    this.noApBenef = noApBenef;
    this.categorieBeneficiaire = categorieBeneficiaire;
    this.sexe = sexe;
    this.assure = assure;
    this.attributaire = attributaire;
    this.prestation = prestation;
}



public Integer getIdBenef() {
    return idBenef;
}

public void setIdBenef(Integer idBenef) {
    this.idBenef = idBenef;
}

public Integer getNoBenef() {
    return noBenef;
}

public void setNoBenef(Integer noBenef) {
    this.noBenef = noBenef;
}

public String getNomBenef() {
    return nomBenef;
}

public void setNomBenef(String nomBenef) {
    this.nomBenef = nomBenef;
}

public Integer getNoApBenef() {
    return noApBenef;
}

public void setNoApBenef(Integer noApBenef) {
    this.noApBenef = noApBenef;
}

public LocalDate getDateNaissanceBenef() {
    return dateNaissanceBenef;
}

public void setDateNaissanceBenef(LocalDate dateNaissanceBenef) {
    this.dateNaissanceBenef = dateNaissanceBenef;
}

public CategorieBeneficiaire getCategorieBeneficiaire() {
    return categorieBeneficiaire;
}

public void setCategorieBeneficiaire(CategorieBeneficiaire categorieBeneficiaire) {
    this.categorieBeneficiaire = categorieBeneficiaire;
}

public Sexe getSexe() {
    return sexe;
}

public void setSexe(Sexe sexe) {
    this.sexe = sexe;
}

public Assure getAssure() {
    return assure;
}

public void setAssure(Assure assure) {
    this.assure = assure;
}

public Attributaire getAttributaire() {
    return attributaire;
}

public void setAttributaire(Attributaire attributaire) {
    this.attributaire = attributaire;
}

public Prestation getPrestation() {
    return prestation;
}

public void setPrestation(Prestation prestation) {
    this.prestation = prestation;
}

public LocalDate getDateEffetPrestation() {
    return dateEffetPrestation;
}

public void setDateEffetPrestation(LocalDate datteEffetPrestation) {
    this.dateEffetPrestation = datteEffetPrestation;
}

public BigDecimal getMntMensuelPrestation() {
    return mntMensuelPrestation;
}

public void setMntMensuelPrestation(BigDecimal mntMensuelPrestation) {
    this.mntMensuelPrestation = mntMensuelPrestation;
}

public Integer getTrimestreDerniereEmission() {
    return trimestreDerniereEmission;
}


public void setTrimestreDerniereEmission(Integer trimestreDerniereEmission) 
{
    this.trimestreDerniereEmission = trimestreDerniereEmission;
}


public Integer getAnneeDerniereEmission() {
    return anneeDerniereEmission;
}


public void setAnneeDerniereEmission(Integer anneeDerniereEmission) {
    this.anneeDerniereEmission = anneeDerniereEmission;
}


public Integer getEstActifBenef() {
    return estActifBenef;
}

public void setEstActifBenef(Integer estActifBenef) {
    this.estActifBenef = estActifBenef;
}

public LocalDateTime getDateheureCreationBenef() {
    return dateheureCreationBenef;
}

public void setDateheureCreationBenef(LocalDateTime dateheureCreationBenef) 
{
    this.dateheureCreationBenef = dateheureCreationBenef;
}

public Utilisateur getUtilisateur() {
    return utilisateur;
}

public void setUtilisateur(Utilisateur utilisateur) {
    this.utilisateur = utilisateur;
}





//For Test Equal, override equals() and hashCode()
@Override
public boolean equals(Object o) {

    if (this == o)
        return true;
    if (o == null || getClass() != o.getClass())
        return false;
    Beneficiaire beneficiaire = (Beneficiaire) o;

    return noBenef.equals(beneficiaire.getNoBenef());
}

@Override
public int hashCode() {
    return Objects.hash(noBenef);
}

}

PieceJustificative class :

@Entity
@Table(uniqueConstraints=
@UniqueConstraint(name="u_pj_noPj", columnNames="noPj"))
public class PieceJustificative implements Serializable {

private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private Integer idPj;

@Column(nullable=false)
private Integer noPj;

@DateTimeFormat(pattern="dd/MM/yyyy")
@Column(nullable=false)
private LocalDate dateDebutValiditePj;

@DateTimeFormat(pattern="dd/MM/yyyy")
@Column(nullable=false)
private LocalDate dateFinValiditePj;

@DateTimeFormat(pattern="dd/MM/yyyy")
@Column(nullable=false)
private LocalDate dateSignaturePj;

@Column(columnDefinition="timestamp default current_timestamp not null", insertable=false)
private LocalDateTime dateHeureSaisiePj;

private LocalDateTime dateHeureValidationPj;

@Column(columnDefinition="integer default 0 not null", insertable=false)
private Integer estValidePj;

/*@ManyToOne(optional=false, fetch=FetchType.LAZY)
*/
@ManyToOne
@JoinColumn(name="id_type_pj",
        foreignKey=@ForeignKey(name="fk_pj_id_type_pj"),
        nullable=false)
private TypePj typePj;

/*@ManyToOne(optional=false, fetch=FetchType.LAZY)
@JoinColumn(name="id_beneficiaire",
        foreignKey=@ForeignKey(name="fk_pj_id_beneficiaire"))
*/
/*@ManyToOne(optional=false)*/
@ManyToOne
@JoinColumn(name="idBenef",
        foreignKey=@ForeignKey(name="fk_pj_id_beneficiaire"),
        nullable=false)
private Beneficiaire beneficiairePj;

@ManyToOne
@JoinColumn(name="id_utilisateur_saisie",
        foreignKey=@ForeignKey(name="fk_pj_id_utilisateur_saisie"))
private Utilisateur utilisateurSaisiePj;

@ManyToOne
@JoinColumn(name="id_utilisateur_valide",
        foreignKey=@ForeignKey(name="fk_pj_id_utilisateur_valide"))
private Utilisateur utilisateurValidationPj;



protected PieceJustificative() {
    //For JPA
}

public Integer getIdPj() {
    return idPj;
}

public void setIdPj(Integer idPj) {
    this.idPj = idPj;
}

public Integer getNoPj() {
    return noPj;
}

public void setNoPj(Integer noPj) {
    this.noPj = noPj;
}

public LocalDate getDateDebutValiditePj() {
    return dateDebutValiditePj;
}

public void setDateDebutValiditePj(LocalDate dateDebutValiditePj) {
    this.dateDebutValiditePj = dateDebutValiditePj;
}

public LocalDate getDateFinValiditePj() {
    return dateFinValiditePj;
}

public void setDateFinValiditePj(LocalDate dateFinValiditePj) {
    this.dateFinValiditePj = dateFinValiditePj;
}

public LocalDate getDateSignaturePj() {
    return dateSignaturePj;
}

public void setDateSignaturePj(LocalDate dateSignaturePj) {
    this.dateSignaturePj = dateSignaturePj;
}

public LocalDateTime getDateHeureSaisiePj() {
    return dateHeureSaisiePj;
}

public void setDateHeureSaisiePj(LocalDateTime dateHeureSaisiePj) {
    this.dateHeureSaisiePj = dateHeureSaisiePj;
}

public LocalDateTime getDateHeureValidationPj() {
    return dateHeureValidationPj;
}

public void setDateHeureValidationPj(LocalDateTime dateHeureValidationPj) {
    this.dateHeureValidationPj = dateHeureValidationPj;
}

public Integer getEstValidePj() {
    return estValidePj;
}

public void setEstValidePj(Integer estValidePj) {
    this.estValidePj = estValidePj;
}



/**
 * @return the typePj
 */
public TypePj getTypePj() {
    return typePj;
}

/**
 * @param typePj the typePj to set
 */
public void setTypePj(TypePj typePj) {
    this.typePj = typePj;
}

public Beneficiaire getBeneficiairePj() {
    return beneficiairePj;
}

public void setBeneficiairePj(Beneficiaire beneficiairePj) {
    this.beneficiairePj = beneficiairePj;

}

public Utilisateur getUtilisateurSaisiePj() {
    return utilisateurSaisiePj;
}

public void setUtilisateurSaisiePj(Utilisateur utilisateurSaisiePj) {
    this.utilisateurSaisiePj = utilisateurSaisiePj;
}

public Utilisateur getUtilisateurValidationPj() {
    return utilisateurValidationPj;
}

public void setUtilisateurValidationPj(Utilisateur utilisateurValidationPj) {
    this.utilisateurValidationPj = utilisateurValidationPj;
}

//For Test Equal, override equals() and hashCode()
@Override
public boolean equals(Object o) {

    if (this == o)
        return true;
    if (o == null || getClass() != o.getClass())
        return false;
    PieceJustificative pieceJustificative = (PieceJustificative) o;

    return noPj.equals(pieceJustificative.getNoPj());
}

@Override
public int hashCode() {
    return Objects.hash(noPj);
}

}

My thymeleaf rendered view for list of PieceJustificative :

<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
  xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
  layout:decorator="layouts/layout">
<head>
<meta charset="UTF-8" />
<title>Liste des pièces justificatives</title>
<!-- <link th:href="@{/css/form.css}" rel="stylesheet"/> -->
</head>
<body>
<div id="content" layout:fragment="content">


    <div class="w3-container">
        <h2>Liste des pièces justificatives</h2>  

        <!-- <table class="w3-table-all w3-hoverable"> -->
        <table id="customers">
            <thead>
                <!-- <tr class="w3-light-grey"> -->
                <tr >
                    <th>N° pièce jointe</th>
                    <th>Type pièce jointe</th>
                    <th>N° bénéficiaire</th>
                    <th>Nom bénéficiaire</th>
                    <th>Date début validité</th>
                    <th>Date fin validité</th>
                    <th>Date signature</th>
                    <th>Modifier</th>
                    <th>Supprimer</th>
                </tr>
            </thead>
            <tr th:each="pieceJustificative : ${pieceJustificatives}">

                <td th:text="${pieceJustificative.noPj}">N°</td>
                <td th:text="${pieceJustificative.typePj.libelleTypePj}">libelleTypePj</td>
                <td th:text="${pieceJustificative.beneficiairePj.noBenef}">noBenef</td>
                <td th:text="${pieceJustificative.beneficiairePj.nomBenef}">nomBenef</td>
                <td th:text="${#temporals.format(pieceJustificative.dateDebutValiditePj, 'dd/MM/yyyy')}">dateDebutValiditePj</td>
                <td th:text="${#temporals.format(pieceJustificative.dateFinValiditePj, 'dd/MM/yyyy')}">dateFinValiditePj</td>
                <td th:text="${#temporals.format(pieceJustificative.dateSignaturePj, 'dd/MM/yyyy')}">dateSignaturePj</td>

                <td><a href="listepiecesjustificatives.html" th:href="@{/listepiecesjustificatives/modifier/{idPj}(idPj=${pieceJustificative.idPj})}">Modifier</a></td>
                <td><a href="listepiecesjustificatives.html" th:href="@{/listepiecesjustificatives/supprimer/{idPj}(idPj=${pieceJustificative.idPj})}">Supprimer</a></td>
            </tr>
        </table>
    </div>



    <p>
        <a href="/ajouterpiecejustificative">Ajouter pièce justificative</a>
    </p>

</div><!-- end div content --> 

When I tried to render this list of PieceJustificative, I got this exception, however the Beneficiaire with id 57271 exist in my database :

javax.persistence.EntityNotFoundException: Unable to find ne.cnss.pension.beneficiaire.Beneficiaire with id 57271 at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$JpaEntityNotFoundDelegate.handleEntityNotFound(EntityManagerFactoryBuilderImpl.java:144) ~[hibernate-entitymanager-5.0.12.Final.jar:5.0.12.Final] at org.hibernate.event.internal.DefaultLoadEventListener.load(DefaultLoadEventListener.java:227) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final] at org.hibernate.event.internal.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:278) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final] at org.hibernate.event.internal.DefaultLoadEventListener.doOnLoad(DefaultLoadEventListener.java:121) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final] at org.hibernate.event.internal.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:89) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final] at org.hibernate.internal.SessionImpl.fireLoad(SessionImpl.java:1129) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final] at org.hibernate.internal.SessionImpl.internalLoad(SessionImpl.java:1022) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final] at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:639) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final] at org.hibernate.type.EntityType.resolve(EntityType.java:431) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final] at org.hibernate.engine.internal.TwoPhaseLoad.doInitializeEntity(TwoPhaseLoad.java:154) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final] at org.hibernate.engine.internal.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:128) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final] at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:1133) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final] at org.hibernate.loader.Loader.processResultSet(Loader.java:992) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final] at org.hibernate.loader.Loader.doQuery(Loader.java:930) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final] at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:336) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final] at org.hibernate.loader.Loader.doList(Loader.java:2617) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final] at org.hibernate.loader.Loader.doList(Loader.java:2600) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final] at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2429) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final] at org.hibernate.loader.Loader.list(Loader.java:2424) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final] at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:501) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final] at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:371) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final] at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:216) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final] at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1326) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final] at org.hibernate.internal.QueryImpl.list(QueryImpl.java:87) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final] at org.hibernate.jpa.internal.QueryImpl.list(QueryImpl.java:606) ~[hibernate-entitymanager-5.0.12.Final.jar:5.0.12.Final] at org.hibernate.jpa.internal.QueryImpl.getResultList(QueryImpl.java:483) ~[hibernate-entitymanager-5.0.12.Final.jar:5.0.12.Final] at org.hibernate.jpa.criteria.compile.CriteriaQueryTypeQueryAdapter.getResultList(CriteriaQueryTypeQueryAdapter.java:50) ~[hibernate-entitymanager-5.0.12.Final.jar:5.0.12.Final] at org.springframework.data.jpa.repository.support.SimpleJpaRepository.findAll(SimpleJpaRepository.java:329) ~[spring-data-jpa-1.11.8.RELEASE.jar:na] at org.springframework.data.jpa.repository.support.SimpleJpaRepository.findAll(SimpleJpaRepository.java:74) ~[spring-data-jpa-1.11.8.RELEASE.jar:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_131] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_131] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_131] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_131] at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.executeMethodOn(RepositoryFactorySupport.java:504) ~[spring-data-commons-1.13.8.RELEASE.jar:na] at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:489) ~[spring-data-commons-1.13.8.RELEASE.jar:na] at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:461) ~[spring-data-commons-1.13.8.RELEASE.jar:na] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.12.RELEASE.jar:4.3.12.RELEASE] at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:56) ~[spring-data-commons-1.13.8.RELEASE.jar:na] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.12.RELEASE.jar:4.3.12.RELEASE] at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) ~[spring-tx-4.3.12.RELEASE.jar:4.3.12.RELEASE] at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282) ~[spring-tx-4.3.12.RELEASE.jar:4.3.12.RELEASE] at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) ~[spring-tx-4.3.12.RELEASE.jar:4.3.12.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.12.RELEASE.jar:4.3.12.RELEASE] at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136) ~[spring-tx-4.3.12.RELEASE.jar:4.3.12.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.12.RELEASE.jar:4.3.12.RELEASE] at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:133) ~[spring-data-jpa-1.11.8.RELEASE.jar:na] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.12.RELEASE.jar:4.3.12.RELEASE] at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) ~[spring-aop-4.3.12.RELEASE.jar:4.3.12.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.12.RELEASE.jar:4.3.12.RELEASE] at org.springframework.data.repository.core.support.SurroundingTransactionDetectorMethodInterceptor.invoke(SurroundingTransactionDetectorMethodInterceptor.java:57) ~[spring-data-commons-1.13.8.RELEASE.jar:na] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.12.RELEASE.jar:4.3.12.RELEASE] at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213) ~[spring-aop-4.3.12.RELEASE.jar:4.3.12.RELEASE] at com.sun.proxy.$Proxy162.findAll(Unknown Source) ~[na:na] at ne.cnss.pension.piecejustificative.PieceJustificativeService.listeDesPiecesJustificatives(PieceJustificativeService.java:101) ~[classes/:na] at ne.cnss.pension.piecejustificative.PieceJustificativeController.listeDesCategoriesPieceJustificatives(PieceJustificativeController.java:117) ~[classes/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_131] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_131] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_131] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_131] at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) ~[spring-web-4.3.12.RELEASE.jar:4.3.12.RELEASE] at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133) ~[spring-web-4.3.12.RELEASE.jar:4.3.12.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97) ~[spring-webmvc-4.3.12.RELEASE.jar:4.3.12.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827) ~[spring-webmvc-4.3.12.RELEASE.jar:4.3.12.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738) ~[spring-webmvc-4.3.12.RELEASE.jar:4.3.12.RELEASE] at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) ~[spring-webmvc-4.3.12.RELEASE.jar:4.3.12.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967) ~[spring-webmvc-4.3.12.RELEASE.jar:4.3.12.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901) ~[spring-webmvc-4.3.12.RELEASE.jar:4.3.12.RELEASE] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) ~[spring-webmvc-4.3.12.RELEASE.jar:4.3.12.RELEASE] at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861) ~[spring-webmvc-4.3.12.RELEASE.jar:4.3.12.RELEASE] at javax.servlet.http.HttpServlet.service(HttpServlet.java:635) ~[tomcat-embed-core-8.5.23.jar:8.5.23] at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) ~[spring-webmvc-4.3.12.RELEASE.jar:4.3.12.RELEASE] at javax.servlet.http.HttpServlet.service(HttpServlet.java:742) ~[tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) ~[tomcat-embed-websocket-8.5.23.jar:8.5.23] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.23.jar:8.5.23] at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) ~[spring-web-4.3.12.RELEASE.jar:4.3.12.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.12.RELEASE.jar:4.3.12.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.23.jar:8.5.23] at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:108) ~[spring-web-4.3.12.RELEASE.jar:4.3.12.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.12.RELEASE.jar:4.3.12.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.23.jar:8.5.23] at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81) ~[spring-web-4.3.12.RELEASE.jar:4.3.12.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.12.RELEASE.jar:4.3.12.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.23.jar:8.5.23] at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) ~[spring-web-4.3.12.RELEASE.jar:4.3.12.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-4.3.12.RELEASE.jar:4.3.12.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199) ~[tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478) [tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) [tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81) [tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) [tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342) [tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803) [tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868) [tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459) [tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-8.5.23.jar:8.5.23] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_131] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_131] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.5.23.jar:8.5.23] at java.lang.Thread.run(Thread.java:748) [na:1.8.0_131]

1

1 Answers

0
votes

Try fetch=FetchType.EAGER Default is lazy. It should work.