Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] The number of actual and formal parameters differs,

Hello,

From the error, it looks like it is call setParDoctorant and passing in a "0" instead of a boolean, but the full stack would contain more. What is the database field type for the PAR_DOCTORANT field, and do inserts work?

If the database field type is not a boolean type, (such as a string or Integer), you will need to try to map it to something different than a boolean or use a ObjectTypeConverter mapping:
  http://forums.java.net/jive/message.jspa?messageID=203783

Best Regards,
Chris

Yannick Majoros wrote:
Hello,

I am trying to fix some problem with a boolean field. On some data, I consistently get an exception on the first time I try to retrieve it from the database. Here is my persistent class:

package be.uclouvain.doctorat.model.entity;

import be.uclouvain.doctorat.model.entity.util.WithDemande;
import be.uclouvain.doctorat.model.entity.util.WithId;

import be.uclouvain.doctorat.model.util.DecisionIntervenant;
import java.io.Serializable;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name = "commentaires")
public class Commentaire implements Serializable, WithDemande, WithId {

   public static final long serialVersionUID = 2008051501;
   private Long id;
   private String commentaire;
   private Date dateModification;
   private boolean parDoctorant;
   private Demande demande;
   private Personne personne;
   private boolean confidentiel;
   private DecisionIntervenant decision;

   public Commentaire() {
   }

   public String getCommentaire() {
       return commentaire;
   }

   public void setCommentaire(String commentaire) {
       this.commentaire = commentaire;
   }

   @Temporal(TemporalType.DATE)
   @Column(name = "DATE_MODIFICATION")
   public Date getDateModification() {
       return dateModification;
   }

   public void setDateModification(Date dateModification) {
       this.dateModification = dateModification;
   }

   @Id
   @GeneratedValue(generator = "idSeq")
@SequenceGenerator(name = "idSeq", sequenceName = "IDENTIFIERS", allocationSize = 1)
   @Column(nullable = false)
   public Long getId() {
       return id;
   }

   public void setId(Long id) {
       this.id = id;
   }

   @Column(name = "PAR_DOCTORANT", nullable = false)
   public boolean isParDoctorant() {
       return parDoctorant;
   }

   public void setParDoctorant(boolean parDoctorant) {
       this.parDoctorant = parDoctorant;
   }

   @ManyToOne(fetch = FetchType.EAGER)
   @JoinColumn(name = "DEMANDE_ID", referencedColumnName = "ID")
   public Demande getDemande() {
       return demande;
   }

   public void setDemande(Demande demande) {
       this.demande = demande;
   }

   @ManyToOne(fetch = FetchType.EAGER)
   @JoinColumn(name = "PERSONNE_ID", referencedColumnName = "ID")
   public Personne getPersonne() {
       return personne;
   }

   public void setPersonne(Personne personne) {
       this.personne = personne;
   }

   @Column(name = "CONFIDENTIEL", nullable = false)
   public boolean isConfidentiel() {
       return confidentiel;
   }

   public void setConfidentiel(boolean param) {
       this.confidentiel = param;
   }

   @Enumerated(EnumType.STRING)
   public DecisionIntervenant getDecision() {
       return decision;
   }

   public void setDecision(DecisionIntervenant decision) {
       this.decision = decision;
   }

   public Commentaire dbCopy() {
       Commentaire newCommentaire = new Commentaire();
       newCommentaire.setDateModification(dateModification);
       newCommentaire.setParDoctorant(parDoctorant);
       newCommentaire.setDemande(demande);
       newCommentaire.setPersonne(personne);
       newCommentaire.setConfidentiel(confidentiel);
       newCommentaire.setDecision(decision);
       return newCommentaire;
   }

   @Override
   public boolean equals(Object obj) {
       if (obj == null) {
           return false;
       }
       if (getClass() != obj.getClass()) {
           return false;
       }
       final Commentaire other = (Commentaire) obj;
if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) {
           return false;
       }
       return true;
   }

   @Override
   public int hashCode() {
       int hash = 3;
       hash = 59 * hash + (this.id != null ? this.id.hashCode() : 0);
       return hash;
   }
}


And the exception:

Exception Description: Trying to invoke [setParDoctorant] on the object [0]. The number of actual and formal parameters differs, or an unwrapping conversion has failed.
Internal Exception: java.lang.IllegalArgumentException
at be.uclouvain.doctorat.model.service._IDemandeService_Wrapper.getCommentairesList(be/uclouvain/doctorat/model/service/_IDemandeService_Wrapper.java)

Any clue?



Back to the top