-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Weird implementation of insert="false" on Hibernate 3.6.9
PostPosted: Thu Dec 15, 2016 10:08 am 
Newbie

Joined: Thu Dec 15, 2016 9:52 am
Posts: 1
I have the following property in my hbm.xml files:

Code:
<property name="xml" type="materialized_clob" column="XDD_XML" not-null="true" length="1000000000" />


It's fine most of the time but sometime we really have objects big enough to justify this length which is not very nice for the memory.

So I decided to use real clob to stream a bit more all that.

The constraint is that I can't break any Java or HQL API so I have to keep the current String "xml" based property and the corresponding String get/setXml(). I was expecting to find some kind of alias system that would allow me to say that "xml" property lead to another method now which is Clob based instead but look like there is nothing like this (maybe there is in version more recent than 3.6.9 ?).

So I did the following:

Code:
        <property name="xmlClob" type="clob" column="XDD_XML" not-null="true" length="1000000000" />
        <!-- The "real" Hibernate property is "xmlClob". "xml" property is here to allow the use of the more intuitive "xml" name in requests  -->
        <property name="xml" update="false" insert="false" type="materialized_clob" column="XDD_XML" not-null="true" length="1000000000" />


I have corresponding Clob get/setXmlClob() methods and all seemed OK but then I discovered that Hibernate still call getXml() when inserting my entity which make everything I did pretty much useless from memory footprint improvement point of view.

I know, 3.6.9 is quite old. But before trying to upgrade (or some nasty hack) I would like to understand why it does that. Is there something I did not understood ? Is this just not very optimized implementation in this version that have been improved in more recent version ? Is it still like this and there is nothing I can do without breaking my API ?


Top
 Profile  
 
 Post subject: Re: Weird implementation of insert="false" on Hibernate 3.6.9
PostPosted: Thu Dec 15, 2016 11:35 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
That would require some debugging from you to find out why Hibernate calls the method even if it's meant to be non-insertable.

I think it's worth trying it on a newer Hibernate release, like 5.2.5 and see if it still replicates.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.