Hi mf125085,
I got to do as you advised and work fine, Therefore I didn't put number and phoneType in PhonePK but in Phone.
Follow the final code:
[code]
@Entity
@Table( name="CFGCUSTOM" )
@javax.persistence.SequenceGenerator(
name="SEQ_CUSTOM",
sequenceName="SEQ_CUSTO" )
public class Customer extends VObject {
@Id
@Column( name="NIDCUST" )
@GeneratedValue( strategy=GenerationType.SEQUENCE, generator="SEQ_CUSTO" )
private Long id;
@NotNull
@Column( name="CNAMECUST")
private String name;
@OneToMany(fetch=FetchType.EAGER, mappedBy = "customer")
private Set<Phone> phones = new HashSet<Phone>();
....
....
....
}
[/code]
[code]
@Entity
@Table( name="CFGPHONE" )
@IdClass(PhonePk.class)
public class Phone extends VObject {
@Id
@Column(name="NIDPHONE", nullable = false)
private Long id;
@Id
@Column(name="NIDCUST", nullable = false, insertable = false, updatable = false)
private Long idCustomer;
@NotNull
@Column( name="CFGNPHONE" )
private String number
@NotNull
@Column( name="CTYPEPHONE" )
private String phoneType;
@ManyToOne
@JoinColumn(name = "NIDCUST", referencedColumnName = "NIDCUST")
private Customer customer;
....
....
....
}
[/code]
[code]
public class PhonePk implements Serializable {
@Column( name="NIDPHONE" )
private Long id;
@Column(name="NIDCUST")
private Customer idCustomer;
....
....
....
}
[/code]
Best regards,
Cleiton
[Message sent by forum member 'cleitonls' (cleitonls)]
http://forums.java.net/jive/thread.jspa?messageID=225236