-->
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.  [ 1 post ] 
Author Message
 Post subject: Strange problem with clob when size > 4000 characters
PostPosted: Thu Sep 25, 2008 1:18 am 
Newbie

Joined: Tue Feb 20, 2007 6:54 am
Posts: 7
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 3.2

Mapping documents: WorkflowAction.hbm.xml

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="workflow.classes">

<class name="WorkFlowAction" table="WorkFlowAction">
<id name="Id" column="Id" type="long" >
<generator class="sequence" />
</id>
<property name="confidentiality" type="string" />
<property name="sourceLink" type="workflow.util.TableType" >
<column name="sourceLink" sql-type="TABLE_TY"/>
</property>
<property name="Final" type="boolean" />
<property name="Reject" type="boolean" />
<property name="status" type="string" />
<property name="creationDate" type="date" />
<property name="lastModified" type="date" />
<property name="sourceDescription" type="string" />
<property name="trn_recipients" type="text" />
<property name="sourceObject" type="text" />
<property name="owner" type="workflow.util.TableType" >
<column name="owner" sql-type="TABLE_TY"/>
</property>
<set name="WorkRoles" inverse="true">
<key column="workFlowAction" />
<one-to-many class="WorkRole" />
</set>
<many-to-one name="previous" class="WorkFlowAction" column="PREVIOUS_ID" unique="true"/>
<one-to-one name="next" class="WorkFlowAction" property-ref="previous"/>

<many-to-one name="state" class="State"/>
</class>

</hibernate-mapping>



Full stack trace of any exception that occurs: No exception occures

Name and version of the database you are using: oracle 9i

This mapping file is for a class in java which you can see has a one-to-one relationship with itself. The problem here is strange and easily reproducible. When an object of this type is added with the previous property set up to point to another object of the same type and the source object having a string with length > 4000 chars then it saves without any problem. The Hibernate sql shows that it internally runs an insert statement and all is wee and the object is created. But after calling a session.save on the new object if a property on the new object is changed and ALSO a property on the object pointed to by the "previous" property is changed, then the code just hangs. The Hibernate sql shows that it internally runs an insert statement followed by an update statement for the "previous" object and an update statement for the new object and then execution just hangs. What is even weirder is that this problem only occurs when the "source" property of the new object is set to more than 4000 characters in length. This I found strange because if any one of the properties are not changed after the session.save then it saves properly no matter what the length of the "source" is.

Here is the java code to reproduce this problem.

Any suggestions would be very very helpful.

Code:

public static void main(String[] args) {
      Session session = null;
      org.hibernate.Transaction tx = null;
      try{
              SessionFactory sessionFactory = new Configuration().configure("/WorkFlow.cfg.xml").buildSessionFactory();
            System.out.println("WorkFlowMain Started");
              session = sessionFactory.getCurrentSession();
              session.setFlushMode(FlushMode.MANUAL);
              session = sessionFactory.getCurrentSession();
             
            tx = session.beginTransaction();
            
            WorkFlowAction child = new WorkFlowAction();
            child.setSourceDescription("pix action");
            String srcObj = "<![CDATA[ %3C?xml%20version=%221.0%22%20encoding=%22utf-8%22?%3E%3CQuotationTender%20className=%22procurement.classes.QuotationTender%22%20id=%222094%22%3E%3CCreatedBy%20type=%22EntityLink%22%20display=%22thahil%20naseer%20mohmmed%20alNabhain%22%20enumName=%22EmployeeOnly%22%3EMA%7Cmaster.classes.Employee%7C10372%3C/CreatedBy%3E%3CVendor%20display=%22Al%20Batina%20company%20for%20modern%20publishing%20technology%22%3E40%3C/Vendor%3E%3CStatus%3EDR%3C/Status%3E%3CCurrency/%3E%3CReferenceNumber%3Equot01%3C/ReferenceNumber%3E%3CRemarks/%3E%3CTotalScore%3E0.000%3C/TotalScore%3E%3CAverageScore%3E0.000%3C/AverageScore%3E%3CExpiryDate%3E2008-09-22%3C/ExpiryDate%3E%3CPaymentConditions%20private=%22true%22/%3E%3COwner%20private=%22true%22%3EMA%7Cmaster.classes.Employee%7C10372%3C/Owner%3E%3CConfidentiality%20private=%22true%22/%3E%3CCurrentlyInWorkflow%20private=%22true%22%3Efalse%3C/CurrentlyInWorkflow%3E%3CCaptureDate%20private=%22true%22%3E2008-09-22%3C/CaptureDate%3E%3CCaptureTime%20private=%22true%22%3E11:42:12%3C/CaptureTime%3E%3CFinalState%20private=%22true%22/%3E%3CSelection%20className=%22procurement.classes.Selection%22%20id=%222096%22%3E%3CReason/%3E%3C/Selection%3E%3CVendorItems%20className=%22procurement.classes.VendorItem%22%20id=%222095%22%3E%3CItemMaster%20type=%22EntityLink%22%20display=%22FST-CARHP%20%22%20enumName=%22ItemMaster%22%3EMA%7Cmaster.classes.ItemMaster%7C13139%3C/ItemMaster%3E%3CDeliveryLocation%20type=%22EntityLink%22%20display=%22Main%20Store%22%20enumName=%22Locations%22%3EMA%7Cmaster.classes.Location%7C14620%3C/DeliveryLocation%3E%3CItemDescription%20type=%22EntityLink%22%20display=%22Cardmum%20/Haell%20Powder%22%20enumName=%22ItemMaster%22%3EMA%7Cmaster.classes.ItemMaster%7C13139%3C/ItemDescription%3E%3CUOM%20type=%22EntityLink%22%20display=%22No.%22%20enumName=%22ItemMaster%22%3EMA%7Cmaster.classes.ItemMaster%7C13139%3C/UOM%3E%3CManufacturer%20type=%22EntityLink%22%20display=%22%22%20enumName=%22ItemMaster%22%3EMA%7Cmaster.classes.ItemMaster%7C13139%3C/Manufacturer%3E%3CQuantity%3E10.000%3C/Quantity%3E%3CRemarks/%3E%3CPrice%3E0.000%3C/Price%3E%3CRequiredByDate%3E2008-09-22%3C/RequiredByDate%3E%3CCancel%20private=%22true%22%3Efalse%3C/Cancel%3E%3CTotalPrice%3E0.000%3C/TotalPrice%3E%3CLastPurchaseOrderValue%3E0.000%3C/LastPurchaseOrderValue%3E%3CWarrantyPeriod/%3E%3CReconcile%20private=%22true%22%3Efalse%3C/Reconcile%3E%3CSuppliedItemId%3E0%3C/SuppliedItemId%3E%3CCommitmentNumber%20private=%22true%22%3ENot%20Commited%3C/CommitmentNumber%3E%3CDeliveryTime%3E0%3C/DeliveryTime%3E%3CRequestNo%20private=%22true%22/%3E%3COriginalItem%20type=%22EntityLink%22/%3E%3CSpecification/%3E%3CRequestedItem%20className=%22procurement.classes.Item%22%20id=%222091%22%3E%3CItemMaster%20type=%22EntityLink%22%20display=%22Cardmum%20/Haell%20Powder%22%20enumName=%22ItemMaster%22%3EMA%7Cmaster.classes.ItemMaster%7C13139%3C/ItemMaster%3E%3CDeliveryLocation%20type=%22EntityLink%22%20display=%22Main%20Store%22%20enumName=%22Locations%22%3EMA%7Cmaster.classes.Location%7C14620%3C/DeliveryLocation%3E%3CQuantity%3E10.000%3C/Quantity%3E%3CPrice%3E0.000%3C/Price%3E%3CRemarks/%3E%3CCancel%3Efalse%3C/Cancel%3E%3CProvisionNumber/%3E%3CRequiredByDate%3E2008-09-22%3C/RequiredByDate%3E%3COrderQuantity%3E10.000%3C/OrderQuantity%3E%3CTotalPrice%3E0.000%3C/TotalPrice%3E%3C/RequestedItem%3E%3CSuppliedItems%20className=%22procurement.classes.Item%22%20id=%222091%22%3E%3CItemMaster%20type=%22EntityLink%22%20display=%22Cardmum%20/Haell%20Powder%22%20enumName=%22ItemMaster%22%3EMA%7Cmaster.classes.ItemMaster%7C13139%3C/ItemMaster%3E%3CDeliveryLocation%20type=%22EntityLink%22%20display=%22Main%20Store%22%20enumName=%22Locations%22%3EMA%7Cmaster.classes.Location%7C14620%3C/DeliveryLocation%3E%3CQuantity%3E10.000%3C/Quantity%3E%3CPrice%3E0.000%3C/Price%3E%3CRemarks/%3E%3CCancel%3Efalse%3C/Cancel%3E%3CProvisionNumber/%3E%3CRequiredByDate%3E2008-09-22%3C/RequiredByDate%3E%3COrderQuantity%3E10.000%3C/OrderQuantity%3E%3CTotalPrice%3E0.000%3C/TotalPrice%3E%3C/SuppliedItems%3E%3C/VendorItems%3E%3C/QuotationTender%3E]]>";
            //srcObj = srcObj.substring(0, 4000);
            child.setSourceObject(srcObj);
            
            long id = 2209;
            WorkFlowAction parent = (WorkFlowAction)session.load(WorkFlowAction.class, id);
            
            child.setPrevious(parent);
            
            session.save(child);
            
            parent.setConfidentiality("conf");
            child.setConfidentiality("confidentiality");
            
            session.flush();
            System.out.println("b4 commit");
            tx.commit();
            System.out.println("WorkFlowMain Done");
         }catch(Exception e){
            e.printStackTrace();
         }finally{
         }
   }



Thanks in advance.
pix. :)


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

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.