|Re: [TENEO] Unable to save a clob type attribute during merge [message #1250426 is a reply to message #1249524]
||Wed, 19 February 2014 08:29
| Martin Taal
Registered: July 2009
I did a quick google search and it seems that clob/blob's are ignored in merge operations (by hibernate). But I am not
sure if that has been solved in later hibernate versions. The links I found are not that clear on it.
Can you ask your question on the hibernate forum?
Btw, instead of merge, in my experience with json (de-)serialization. When doing the de-serialization I resolve the
references also against data in the database, so then the de-serialized objects are automatically part of the session.
I don't know your environment, but maybe you can already do resolving against the session objects in your code, so
instead of creating new copies of objects, check if they exist in the database, use hibernate to read it, then the
object graph becomes a mix of new and existing objects which can be persisted using saveOrUpdate. My experience is that
this is a bit 'safer' than doing merge.
Or alternatively, do a manual merge yourselve, using the eclass/efeatures it is quite doable to write your own merge
code (not completely trivial either..). But maybe you can customize/do your own merge specifically for the clob field.
On 02/18/2014 11:34 AM, Minu martin wrote:
> I have a generic application and the entities are generated dynamically run time.
> I have an ecore model with an attribute which is annotated as a clob data type with this annotation:
> I am using dynamic hibernate map for entities and not java classes.
> I am trying to create an object with a file attribute.
> Before performing create I need to do a hibernate merge operation.
> This is to avoid exception in case any instance of the request(associated instances) already exists in session .
> But in this case while merging the object with file attribute, the file attribute value becomes null after merge and
> hence file attribute does not get inserted. But if I try to save the object with session.save, it inserts the file
> attribute value succesfully.
> Is there any reason merge cannot handle this attribute of clob data type?Or am I missing something?
With Regards, Martin Taal
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Powered by FUDForum
. Page generated in 0.02608 seconds