mercredi 24 juin 2015

Why JPA\Hibernate don't automatically create this mapped field?

I am working on a Java web application that use JPA\Hibernate and I am not so into this technology.

So I have the following problem: I have a model class named ReaDichiarazioneIntento that is mapped to a database table named REA_DICHIARAZIONE_INTENTO.

Something like this:

@javax.persistence.IdClass(it.enel.wearea.entity.ReaDichiarazioneIntentoPK.class)
@javax.persistence.Table(name = "REA_DICHIARAZIONE_INTENTO", schema = "EDIWEA")
@Entity
public class ReaDichiarazioneIntento implements Cloneable {

    private Integer idDichiarazione;

    @javax.persistence.Column(name = "ID_DICHIARAZIONE")
    @Id
    public Integer getIdDichiarazione() {
        return idDichiarazione;
    }

    public void setIdDichiarazione(Integer idDichiarazione) {
        this.idDichiarazione = idDichiarazione;
    }
    ...................................................................
    ...................................................................
    ...................................................................
    SOME OTHER FIELDS AND RELATED GETTER AND SETTER METHODS
    ...................................................................
    ...................................................................
    ...................................................................

}

My boss say to me that I have to add and map a new field into this table, so I have added this field (adding it and the related getter and setter method into the previous class), adding this code to the previous class:

private Date dataTrasmissioneAde;

@javax.persistence.Column(name = "DATA_TRASMISSIONE_ADE")
@Basic
public Date getDataTrasmissioneAde() {
    return dataTrasmissioneAde;
}

public void setDataTrasmissioneAde(Date dataTrasmissioneAde) {
    this.dataTrasmissioneAde = dataTrasmissioneAde;
}

He say to me that, restarting the application server, Hibernate would automatically create this field into my table.

I obtain no error but looking inside my table I can't find the DATA_TRASMISSIONE_ADE column.

Why JPA\Hibernate have not automatically created this column after that I have mapped it into my model class? What could be the problem? What am I missing?

Tnx

Aucun commentaire:

Enregistrer un commentaire