[RESOLVIDO]Instanciar classe TabprocPK

1 resposta
E

Pessoal, tenho as seguintes classes :

public class Tabproc implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TabprocPK tabprocPK;


getter's e setter's

************************

@Embeddable
public class TabprocPK implements Serializable {
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 8)
    @Column(nullable = false, length = 8)
    private String codproc;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 8)
    @Column(name = "cod_int", nullable = false, length = 8)
    private String codInt;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 5)
    @Column(nullable = false, length = 5)
        private String codtab;
getter's e setter's

Gostaria de usar o set no valores da minha classe TabprocPK assim :

public void incluiprocedimento() {
           Cadguia guia = new Cadguia();
         guia.setCodguia(1);

         Integer vid = 0;
            for (Itensguia met:Itensguias) {					
                    itemguia.add(new Itensguia(1,met.getId(),met.getTabproc(),guia));                        
                    vid = met.getId();
            }    
            
            Tabproc taproc = new Tabproc();
//            taproc.getTabprocPK().setCodproc(getCodproced()); ***tentei fazer assim mas da erro de nullpoint
            taproc.setDescricao(getDescproced());
            
            itemguia.add(new Itensguia(1,vid+1,taproc,guia));                        
            Itensguias = itemguia; 
    
   }

Alguem pode me ajudar ???

1 Resposta

E

Consegui fazer assim :

TabprocPK taprocpk = new TabprocPK();
                  taprocpk.setCodproc(getCodproced());

                   Tabproc taproc = new Tabproc();
                   taproc.setTabprocPK(taprocpk);
                   taproc.setDescricao(getDescproced());
Criado 25 de março de 2013
Ultima resposta 25 de mar. de 2013
Respostas 1
Participantes 1