users@glassfish.java.net

RE: discriminatorcolumn problem

From: Joao Cabral <jcabral_at_orientacao-lda.pt>
Date: Wed, 3 Mar 2010 18:47:22 -0000

File Rh_ge2PK.java


@Embeddable
public class Rh_ge2PK implements Serializable {

 @Basic(optional = false)
 @Column( name="g2gsoc", nullable = false,length= 4 )
 private String g2gsoc; //


 @Basic(optional = false)
 @Column( name="g2tab", nullable = false,
insertable=false,updatable=false,length= 1 )
 private String g2tab; //

@Basic(optional = false)
 @Column( name="g2cod", nullable = false,length= 2 )
 private String g2cod; //

    public Rh_ge2PK() {}

    public Rh_ge2PK(String p_g2gsoc, String p_g2cod) {
        g2gsoc = (p_g2gsoc == null) ? p_g2gsoc : p_g2gsoc.toUpperCase();
        g2cod = (p_g2cod == null) ? p_g2cod : p_g2cod.toUpperCase();
    }
  


    public String getG2gsoc() { return g2gsoc; }
    public void setG2gsoc(String p_g2gsoc) {
       this.g2gsoc = p_g2gsoc;
    }

    public String getG2tab() { return g2tab; }
    public void setG2tab(String p_g2tab) {
       this.g2tab = p_g2tab;
    }

    public String getG2cod() { return g2cod; }
    public void setG2cod(String p_g2cod) {
       this.g2cod = p_g2cod;
    }

.

} /* Rh_ge2PK */


File Rh_ge2.java

@Entity
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name="g2tab")
@Table(name = "rh_ge2")
public abstract class Rh_ge2 extends Utils.Jpa.JpaUtils.GenericBaseEntity
implements Serializable {
 
  @EmbeddedId
  protected Rh_ge2PK rh_ge2pk;

@Column( name="g2dsg",length= 40 )
 private String g2dsg; // Descricao do Codigo

    public Rh_ge2() {}
    public Rh_ge2(Rh_ge2PK rh_ge2pk) {
       this.rh_ge2pk = rh_ge2pk;
    }

    
  public Rh_ge2PK getRh_ge2pk() { return rh_ge2pk; }
  public void setRh_ge2pk(Rh_ge2PK p_rh_ge2pk) {
     Rh_ge2PK oldrh_ge2pk = this.rh_ge2pk;
     this.rh_ge2pk = p_rh_ge2pk;
  }


    public String getG2dsg() { return g2dsg; }
    public void setG2dsg(String p_g2dsg) {
       String oldg2dsg = this.g2dsg;
       this.g2dsg = p_g2dsg;
    }

.

} /* Rh_ge2 */