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,


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:

Best Regards,

Yannick Majoros wrote:

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.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;

@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;

   @Column(name = "DATE_MODIFICATION")
   public Date getDateModification() {
       return dateModification;

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

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

   public void setId(Long 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;

   public DecisionIntervenant getDecision() {
       return decision;

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

   public Commentaire dbCopy() {
       Commentaire newCommentaire = new Commentaire();
       return newCommentaire;

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

   public int hashCode() {
       int hash = 3;
       hash = 59 * hash + ( != null ? : 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/

Any clue?

Back to the top