java - Converting Between Hibernate Collections and My Own Collections -


i have set hibernate give me set<integer> convert internally , set<myobjecttype> (myobjecttype can represented single integer). say, when hibernate calls void setmyobjecttypecollection(set<integer> theset) method iterate through elements in theset , convert them myobjecttype. when hibernate calls set<myobjecttype> getmyobjecttypecollection() allocate new hashset , convert myobjecttypes integers.

the problem every time call commit, hibernate deletes in collection , re-inserts regardless of whether element of collection has changed or collection has changed.

while don't technically consider bug, afraid deleting , inserting many rows cause database perform unnecessarily slowly.

is there way hibernate recognize though have allocated , returned different instance of collection, collection contains items used , there no need delete , reinsert them all?

i think best way achieve goal use usertype. lets handle conversion sql own objects (back , forth).

you can see example on how use here.


Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -