I'm managing to get this collection to properly save new entries, but I'm still having an issue with with updating or deleting entries in these collections. The problem is, in part, because the insert statements are issued prior to the update statement on the parent object. I've also noted that other collections using @CollectionOfElements are fully deleting entries prior to inserting the new instances, thereby ensuring the accuracy of the data matches that of the user's input.
So, my question is how to effectively remove deleted entries and update information in other entries.
Code:
Hibernate:
select
companymar_.account_company_id,
companymar_.competitor_company_id,
companymar_.market_share as market3_21_
from
Company_Market_Share companymar_
where
companymar_.account_company_id=?
and companymar_.competitor_company_id=?
Hibernate:
select
companymar_.account_company_id,
companymar_.competitor_company_id,
companymar_.market_share as market3_21_
from
Company_Market_Share companymar_
where
companymar_.account_company_id=?
and companymar_.competitor_company_id=?
Hibernate:
select
companymar_.account_company_id,
companymar_.competitor_company_id,
companymar_.market_share as market3_21_
from
Company_Market_Share companymar_
where
companymar_.account_company_id=?
and companymar_.competitor_company_id=?
Hibernate:
insert
into
Company_Market_Share
(market_share, account_company_id, competitor_company_id)
values
(?, ?, ?)
Hibernate:
update
Company
set
This is the SQL that is generated when updating this specific entity. When looking at other collections, the following occurs:
Code:
Hibernate:
update
Company
set
update_dttm=?,
update_user_name=?,
address1=?,
address2=?,
city=?,
country=?,
postal_code=?,
state=?,
alter_market_share=?,
company_name=?,
company_status_id=?,
company_type_id=?,
email=?,
fax=?,
notes=?,
parent_company_id=?,
phone=?,
service_priority_id=?,
url=?
where
company_id=?
Hibernate:
delete
from
Company_Branch
where
company_id=?
Hibernate:
delete
from
Company_Trader
where
company_id=?
Hibernate:
insert
into
Company_Branch
(company_id, branch)
values
(?, ?)
Hibernate:
insert
into
Company_Trader
(company_id, trader_id)
values
(?, ?)
At this point I'm completely hung up on this. Also, I'm not using any entity manager at this point, but rather a Spring simple form controller (working on migration to webflow) and a single call to saveObject(PK Id) within that specific DAO.
Any help would be MOST appreciated. Again, I'm REALLY stuck on this, and I've searched for days through the forums and have been unable to find any pertinent help...
Thanks,
AJ