Help:

I have a model class called DealResource that has a composite id (embeddedId)
call dealResourceId which represents the primary key. I am using Hibernate JPA
with annotations and I am able to insert records but if I try to
update an existing record
hibernate tries to insert the record instead of updating the record
and as a result I get
unique constatraint errors. I debugged my code and traces to the
method merge is being called on the EntityManager so it should indeed
update the record but it tryies to insert.
I am using Hibernate 3.2.ga with JPA and Spring 2.0. Why can't I seem
to do an update?
while the insert works fine.

DealResource class
===============
@Table(name = "df_deal_resource", schema="DEALFLOW")
public class DealResource extends BaseObject {
private DealResourceId          dealResourceId;
@EmbeddedId
@AttributeOverrides({
@AttributeOverride(name = "dealId", column= @Column(name="DEAL_ID")),
@AttributeOverride(name = "userSSOId", column= @Column(name="USER_SSO_ID")),
@AttributeOverride(name = "roleId", column= @Column(name="ROLE_ID")),
@AttributeOverride(name = "loeId", column= @Column(name="LOE_ID")),
@AttributeOverride(name = "loeStartDate", column=
@Column(name="LOE_START_DATE"))
   })
public DealResourceId getDealResourceId() {
                return dealResourceId;
}

DealResourceId class:
================
public class DealResourceId implements Serializable {
        private static final long serialVersionUID = 8303672607943824390L;
        private Long dealId;
        private Long userSSOId;
        private Long roleId;
        private Long loeId;
        private Date loeStartDate;
--
- Paul

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to