sexta-feira, 29 de junho de 2012

@OneToOne com chave compartilhada


@Entity@DiscriminatorValue(value="S")@SequenceGenerator(name="seq_abreprocesso", sequenceName="seq_abreprocesso", allocationSize=1)public class ProcessoSc extends AbreProcesso implements Serializable{ @OneToOne(cascade = CascadeType.ALL) @PrimaryKeyJoinColumn(name="id") private Sc sc;
public Sc getSc() { return sc; }
public void setSc(Sc sc) { this.sc = sc; }
@Override public int hashCode() { return super.hashCode(); }
@Override public boolean equals(Object obj) { return super.equals(obj); } }


.public class Sc implements Serializable{ @Id @GeneratedValue(generator="fk_abreprocesso") @org.hibernate.annotations.GenericGenerator(name="fk_abreprocesso",strategy="foreign",parameters=@Parameter(name="property", value="processoSc" private Integer abreprocesso_id; @OneToOne(mappedBy="sc") private ProcessoSc processoSc;
        Get/Set...}



Nenhum comentário:

Postar um comentário