Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Need help with select query
PostPosted: Thu May 31, 2012 2:38 pm 
Newbie

Joined: Thu May 31, 2012 2:10 pm
Posts: 2
I'm researching an issue we are seeing with saving data and this output is all I see:

Code:
org.hibernate.PropertyValueException: not-null property references a null or transient value: com.mycomp.hibernateobjects.MassMailerHLO.envelopes
   at org.hibernate.engine.Nullability.checkNullability(Nullability.java:72)
   at org.hibernate.event.def.DefaultFlushEntityEventListener.scheduleUpdate(DefaultFlushEntityEventListener.java:236)
   at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:144)
   at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:187)
   at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:73)
   at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:39)
   at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:717)
   at org.hibernate.impl.SessionImpl.prepareQueries(SessionImpl.java:901)
   at org.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:891)
   at org.hibernate.impl.SessionImpl.list(SessionImpl.java:840)
   at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
   at com.mycomp.datamanagers.JobDM.getJobUIDByJobID(Unknown Source)
   at com.mycomp.datamanagers.WorkOrderMassMailerDM.getMassMailerDetails(Unknown Source)
   at com.mycomp.delegates.WorkOrderMassMailerDelegate.getMassMailerDetails(Unknown Source)
   at com.mycomp.action.MMJobReportAction.viewMMJobReport(Unknown Source)



The code appears to be fetching data and at the end is firing off an update to another table. The code in the JobDM.getJobUIDByJobID is:

Code:
   public String getJobUIDByJobID(String jobID, Session session) throws HibernateException {
      String jobUID = null;
      String strQuery = null;
      Query query = null;
      List list = null;
      JobHLO jobHLO = null;

      try {
         strQuery = "select j from JobHLO j where j.jobid='" + jobID + "'";
         query = session.createQuery(strQuery);
         list = query.list();
         if (list.size() > 0) {
            jobHLO = (JobHLO) list.get(0);
            if (jobHLO != null) {
               jobUID = jobHLO.getJobuid();
            }
         }
      } catch (HibernateException ex) {
         throw ex;
      }
      return jobUID;
   }


The hibernate mapping looks like this:

Code:
    <class name="JobHLO" table="tblJob">
        <id name="jobuid" column="JobUID" type="string">
            <generator class="uuid.hex"/>
        </id>

        <property name="jobid" column="JobID" type="string"  not-null="true" />
        <property name="starttime" column="StartTime" type="timestamp" />
        <property name="endtime" column="EndTime" type="timestamp" />
        <property name="stepuid" column="StepUID" type="string" />
        <property name="status" column="Status" type="integer" />
        <property name="test" column="Test" type="byte"/>

        <many-to-one name="jobDefinition" column="JobDefUID" class="JobDefinitionHLO"  not-null="true" />
       
        <set name="jobSplitTypeSet" inverse="true">
            <key column="JobUID"/>
            <one-to-many class="JobSplitTypeHLO"/>
        </set>
       
        <set name="jobParameterSet" inverse="true">
           <key column="JobUID" />
           <one-to-many class="JobParameterHLO" />
        </set>
       
        <set name="jobStatusSet" inverse="true">
           <key column="JobUID" />
           <one-to-many class="JobStatusHLO" />
        </set>
       
        <set name="massMailerSet" inverse="true">
           <key column="JobUID" />
           <one-to-many class="MassMailerHLO" />
        </set> 


And finally, the hibernate mapping for the object that is indicating the error:

Code:
    <class name="MassMailerHLO" table="tblMassMailer">
        <id name="jobUID" column="JobUID" type="string">
            <generator class="foreign">
               <param name="property">bnJob</param>
            </generator>
        </id>

      <property name="envelopes" column="Envelopes" type="integer" not-null="true" />
        <property name="sheets" column="Sheets" type="integer"  not-null="true" />
        <property name="impressions" column="Impressions" type="integer"  not-null="true" />
        <property name="dueDate" column="DueDate" type="timestamp"  not-null="true" />
        <property name="waste" column="Waste" type="byte"  not-null="true" />   


Any ideas?

Thanks!


Top
 Profile  
 
 Post subject: Re: Need help with select query
PostPosted: Fri Jun 01, 2012 2:36 pm 
Newbie

Joined: Thu May 31, 2012 2:10 pm
Posts: 2
More info:-)

I was able to better trace the flow and there is an update to this table in a prior request that ends up calling the view. I see where the update is followed by a commit, so why would it trigger later on in the view of a completely different table? Is it thinking the object is dirty and attempts to update again? The mechanism is via struts and tiles.....old stuff. Hibernate is whatever version was out in 2005, 3.0 confirmed. This is too big to fail....well to put it more succintly this app has 5 server deployments 2 of which use RMI and the app never sees any downtime.....thousands of transactions/second.....24/7 365. I thought about changing the log4j.xml config to print out INFO levels since all of the debug logging uses INFO. Might give me more data to help trace. Nervous about doing that since WARN and higher creates 1.4Gig logs in a 24 hr period. I'd have to make the change and wait until JBoss picks up the new change in roughly 60 seconds or so and then turn it off after I reproduce the issue. Any advice is greatly appreciated!


Top
 Profile  
 
 Post subject: Re: Need help with select query
PostPosted: Mon Jun 04, 2012 8:31 pm 
Beginner
Beginner

Joined: Mon Jun 04, 2012 12:31 pm
Posts: 20
It sounds like the Envelopes parameter is being set to null prior to that update statement.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 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.