I have a US entity which has a id that is primary key and a userId and a ServiceId that these last two together they too are unique. now I have a userId and a serviceId and I wanna update a US entity and I don't know the correct syntax using hibernate to do that. Would any one help me, please... I've used annotation for entity mapping:
@Id
@Column(name = "USERSERVICE_ID")
@GeneratedValue
private Integer id;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "SERVICE_ID")
private Service service;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "SERVICE_SEND_TYPE_ID")
private ServiceSendType serviceSendType;
@Column(name = "USERSERVICE_LASTSENT")
private String lastSentValue = "";
@Column(name = "USERSERVICE_UNSUBCTIMESTAMP")
private Date unsubscribeDate;
@Column(name = "USERSERVICE_SUBCTIMESTAMP")
private Date subscribeDate;
@Column(name = "USERSERVICE_ENABLED")
private Boolean enabled = false;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "SERVICE_USER_ID")
private User user;