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!