-->
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: Hibernate not adding condition for joining sub classes
PostPosted: Wed Mar 02, 2016 9:34 pm 
Newbie

Joined: Wed Oct 16, 2013 2:53 pm
Posts: 2
Hi,
We are facing a weird issue after upgrading hibernate from 3.1.3 to 4.3.1. Hibernate is not adding condition to join sub classes.

Environment:
Hibernate 4.3.11
Java 8
Oracle 11g


The java and mapping files we are using are given below:

Classes:

[b]1. ClinicalStudyEvent.java

Code:

package edu.wustl.clinportal.domain;

import java.util.Collection;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Set;

import edu.common.dynamicextensions.domain.nui.UserContext;
import edu.common.dynamicextensions.exception.DynamicExtensionsSystemException;
import edu.wustl.clinportal.util.global.Utility;
import edu.wustl.common.actionForm.AbstractActionForm;
import edu.wustl.common.domain.AbstractDomainObject;
import edu.wustl.common.exception.AssignDataException;

/**
*
* @hibernate.class table="CATISSUE_CLINICAL_STUDY_EVENT"
*/
public class ClinicalStudyEvent extends AbstractDomainObject
      implements
         Comparable<ClinicalStudyEvent>
{

   private static final long serialVersionUID = 1L;

   /**
    * System generated unique id.
    */
   private Long id;

   private String collectionPointLabel;

   private Integer studyCalendarEventPoint;

   private Integer noOfEntries;

   private Collection<ClinicalStudyEventFormContextLink> clinicalStudyEventFormContextLinkCollection = new LinkedHashSet<ClinicalStudyEventFormContextLink>();
   private String activityStatus;

   private Boolean isInfiniteEntry;

   private ClinicalStudy clinicalStudy;

   private Collection<EventEntry> eventEntryCollection = new HashSet<EventEntry>();

   private Long relToCPEId;

   /** The wizard like navigation. */
   private Boolean isWizardLikeNavigation;

   /** The wizard like navigation. */
   private Boolean allowDraftSaving;

   /** The wizard like navigation. */
   private Boolean allowFinalSaving;

   public ClinicalStudyEvent()
   {
      super();
   }

   public ClinicalStudyEvent(Long id, Integer noOfEntries, String collectionPointLabel,
         Boolean isInfiniteEntry, Integer studyCalendarEventPoint)
   {
      this.id = id;
      this.noOfEntries = noOfEntries;
      this.collectionPointLabel = collectionPointLabel;
      this.isInfiniteEntry = isInfiniteEntry;
      this.studyCalendarEventPoint = studyCalendarEventPoint;
   }

   public ClinicalStudyEvent(ClinicalStudyEvent copyCSE, ClinicalStudy publishedStudy,
         UserContext userContext) throws DynamicExtensionsSystemException
   {
      this.setCollectionPointLabel(copyCSE.getCollectionPointLabel());
      this.setStudyCalendarEventPoint(copyCSE.getStudyCalendarEventPoint());
      this.setNoOfEntries(copyCSE.getNoOfEntries());
      this.setEventFormContexts(
            getCopyCSEventFormContext(copyCSE, this, publishedStudy, userContext));
      //      this.
      this.setClinicalStudyEventFormContextLinkCollection(
            getCopyEventFormLinkCollection(copyCSE, this));// *****
      this.id = Utility.getPublishedId(ClinicalStudyEvent.class.getName(), copyCSE.getId(),
            copyCSE.getClinicalStudy().getDraftPublishStudyMappingList());
      this.setActivityStatus(copyCSE.getActivityStatus());
      this.setIsInfiniteEntry(copyCSE.getIsInfiniteEntry());
      this.setClinicalStudy(publishedStudy);
      this.setRelToCPEId(copyCSE.getRelToCPEId());
      this.setIsWizardLikeNavigation(copyCSE.getIsWizardLikeNavigation());
      this.setAllowDraftSaving(copyCSE.getAllowDraftSaving());
      this.setAllowFinalSaving(copyCSE.getAllowFinalSaving());
   }

   private Collection<ClinicalStudyEventFormContextLink> getCopyEventFormLinkCollection(
         ClinicalStudyEvent copyCSE, ClinicalStudyEvent newCSE)
               throws DynamicExtensionsSystemException
   {
      Collection<ClinicalStudyEventFormContextLink> formLinkColl = copyCSE
            .getClinicalStudyEventFormContextLinkCollection();
      Collection<ClinicalStudyEventFormContextLink> copyCSEventFormLinkCollection = new LinkedHashSet<ClinicalStudyEventFormContextLink>();

      for (ClinicalStudyEventFormContextLink draftFormLink : formLinkColl)
      {
         copyCSEventFormLinkCollection
               .add(new ClinicalStudyEventFormContextLink(draftFormLink, newCSE));
      }
      return copyCSEventFormLinkCollection;
   }

   private Set<EventFormContext> getCopyCSEventFormContext(ClinicalStudyEvent copyCSE,
         ClinicalStudyEvent newCSE, ClinicalStudy publishStudy, UserContext userContext)
               throws DynamicExtensionsSystemException
   {
      Collection<EventFormContext> csFormContextColl = copyCSE.getEventFormContexts();
      Set<EventFormContext> copyCSEventFormLinkCollection = new LinkedHashSet<EventFormContext>();
      for (EventFormContext draftCSFormContext : csFormContextColl)
      {
         copyCSEventFormLinkCollection
               .add(new EventFormContext(draftCSFormContext, newCSE, userContext));
      }
      return copyCSEventFormLinkCollection;
   }

   /**
    * @return the allowDraftSaving
    */
   public Boolean getAllowDraftSaving()
   {
      return allowDraftSaving;
   }

   /**
    * @param allowDraftSaving the allowDraftSaving to set
    */
   public void setAllowDraftSaving(Boolean allowDraftSaving)
   {
      if (allowDraftSaving == null)
      {
         allowDraftSaving = false;
      }

      this.allowDraftSaving = allowDraftSaving;
   }

   /**
    * @return the allowFinalSaving
    */
   public Boolean getAllowFinalSaving()
   {
      return allowFinalSaving;
   }

   /**
    * @param allowFinalSaving the allowFinalSaving to set
    */
   public void setAllowFinalSaving(Boolean allowFinalSaving)
   {
      if (allowFinalSaving == null)
      {
         allowFinalSaving = false;
      }

      this.allowFinalSaving = allowFinalSaving;
   }

   /**
    * Gets the wizard like navigation.
    *
    * @return the wizard like navigation
    */
   public Boolean getIsWizardLikeNavigation()
   {
      return isWizardLikeNavigation;
   }

   /**
    * Sets the wizard like navigation.
    *
    * @param wizardLikeNavigation the new wizard like navigation
    */
   public void setIsWizardLikeNavigation(Boolean wizardLikeNavigation)
   {
      if (wizardLikeNavigation == null)
      {
         wizardLikeNavigation = false;
      }

      this.isWizardLikeNavigation = wizardLikeNavigation;
   }

   /**
    * @return the clinicalStudy
    * @hibernate.many-to-one column="CLINICAL_STUDY_ID" class="edu.wustl.clinportal.domain.ClinicalStudy"
    * constrained="true"
    */
   public ClinicalStudy getClinicalStudy()
   {
      return clinicalStudy;
   }

   /*
    * @param clinicalStudy the clinicalStudy to set
    */
   public void setClinicalStudy(ClinicalStudy clinicalStudy)
   {
      this.clinicalStudy = clinicalStudy;
   }

   /**
    * @return the collectionPointLabel
    * @hibernate.property name="collectionPointLabel" column="COLLECTION_POINT_LABEL" type="string"
    * length="255"
    *
    */
   public String getCollectionPointLabel()
   {
      return collectionPointLabel;
   }

   /**
    * @param colnPointLbl the collectionPointLabel to set
    */
   public void setCollectionPointLabel(String colnPointLbl)
   {
      collectionPointLabel = colnPointLbl;
   }

   /**
    * @return the studyCalendarEventPoint
    * @hibernate.property name="studyCalendarEventPoint" column="EVENT_POINT" type="int"
    * length="10"
    */
   public Integer getStudyCalendarEventPoint()
   {
      return studyCalendarEventPoint;
   }

   /**
    * @param studyCalEventPnt the studyCalendarEventPoint to set
    */
   public void setStudyCalendarEventPoint(Integer studyCalEventPnt)
   {
      studyCalendarEventPoint = studyCalEventPnt;
   }

   /**
    * @hibernate.id name="id" column="IDENTIFIER" type="long" length="30"
    * unsaved-value="null" generator-class="native"
    * @hibernate.generator-param name="sequence" value="CATISSUE_STUDY_EVNT_SEQ"
    */
   @Override
   public Long getId()
   {
      return id;
   }

   /**
    * @param idt The id to set.
    */
   @Override
   public void setId(Long idt)
   {
      id = idt;
   }

   /**
    * @param arg0
    * @throws AssignDataException
    */
   public void setAllValues(AbstractActionForm arg0) throws AssignDataException
   {
      // empty method
   }

   /**
    * @return the noOfEntries
    * @hibernate.property name="noOfEntries" column="NO_OF_ENTRIES" type="int" length="30"
    *
    */
   public Integer getNoOfEntries()
   {
      return noOfEntries;
   }

   /**
    * @param noOfEntries the noOfEntries to set
    */
   public void setNoOfEntries(Integer noOfEntries)
   {
      this.noOfEntries = noOfEntries;
   }

   /**
    *
    * @return the activityStatus
    * @hibernate.property name="activityStatus" column="ACTIVITY_STATUS" type="string" length="10"
    */
   public String getActivityStatus()
   {
      return activityStatus;
   }

   public void setActivityStatus(String activityStatus)
   {
      this.activityStatus = activityStatus;
   }

   /**
    * @return Returns the studyFormLabel.
    *  @hibernate.property name="isInfiniteEntry" column="IS_INFINITE_ENTRY" type="boolean" length="5"
    */

   public Boolean getIsInfiniteEntry()
   {
      return isInfiniteEntry;
   }

   public void setIsInfiniteEntry(Boolean isInfiniteEntry)
   {
      this.isInfiniteEntry = isInfiniteEntry;
   }

   /* (non-Javadoc)
    * @see java.lang.Object#equals(java.lang.Object)
    */
   @Override
   public boolean equals(Object clStudyEvent)
   {
      boolean returnVal = false;
      if (getId() != null && clStudyEvent instanceof ClinicalStudyEvent)
      {
         ClinicalStudyEvent event = (ClinicalStudyEvent) clStudyEvent;
         if (getId().equals(event.getId()))
         {
            returnVal ^= true;
         }
      }
      return returnVal;
   }

   /* (non-Javadoc)
    * @see java.lang.Object#hashCode()
    */
   @Override
   public int hashCode()
   {
      return 1;
   }

   /**
    * @return
    */
   public Collection<EventEntry> getEventEntryCollection()
   {
      return eventEntryCollection;
   }

   /**
    * Returns collection of form context.
    * @return collection of studyForm context.
    * @hibernate.set name="eventEntryCollection" table="CATISSUE_EVENT_ENTRY"
    * inverse="true" cascade="all"
    * @hibernate.collection-key column="CLINICAL_STUDY_EVENT_ID"
    * @hibernate.collection-one-to-many class="edu.wustl.clinportal.domain.EventEntry"
    */
   public void setEventEntryCollection(Collection<EventEntry> eventEntryColn)
   {
      eventEntryCollection = eventEntryColn;
   }

   /**
    * @param relToCPEId the relToCPEId to set
    */
   public void setRelToCPEId(Long relToCPEId)
   {
      this.relToCPEId = relToCPEId;
   }

   /**
    * @return the relToCPEId
    */
   public Long getRelToCPEId()
   {
      return relToCPEId;
   }

   /**
    *
    */
   public int compareTo(ClinicalStudyEvent event1)
   {
      int compare;
      if (getStudyCalendarEventPoint().equals(event1.getStudyCalendarEventPoint()))
      {
         if (getId() == null && event1.getId() == null)
         {
            compare = 0;
         }
         else
         {
            compare = getId().compareTo(event1.getId());
         }
      }
      else
      {
         compare = getStudyCalendarEventPoint().compareTo(event1.getStudyCalendarEventPoint());
      }
      return compare;
   }

   public Collection<ClinicalStudyEventFormContextLink> getClinicalStudyEventFormContextLinkCollection()
   {
      return clinicalStudyEventFormContextLinkCollection;
   }

   public void setClinicalStudyEventFormContextLinkCollection(
         Collection<ClinicalStudyEventFormContextLink> clinicalStudyEventFormContextLinkCollection)
   {
      this.clinicalStudyEventFormContextLinkCollection = clinicalStudyEventFormContextLinkCollection;
   }

   private Set<EventFormContext> eventFormContexts = new LinkedHashSet<EventFormContext>();

   /**
    * @return the eventFormContexts
    */
   public Set<EventFormContext> getEventFormContexts()
   {
      return eventFormContexts;
   }

   /**
    * @param eventFormContexts the eventFormContexts to set
    */
   public void setEventFormContexts(Set<EventFormContext> eventFormContexts)
   {
      this.eventFormContexts = eventFormContexts;
   }

}



2. CSFormContext.java
Code:

package edu.wustl.clinportal.domain;

import java.util.Collection;
import java.util.HashSet;

import edu.wustl.common.domain.AbstractDomainObject;

public class CSFormContext extends AbstractDomainObject
{

   /**
    *
    */
   private static final long serialVersionUID = 1L;
   protected Long id;
   private String formLabel;
   private Long containerId;
   private String activityStatus;
   private Long orderNumber;

   /**
    * @return the orderNumber
    */
   public Long getOrderNumber()
   {
      return orderNumber;
   }

   /**
    * @param orderNumber the orderNumber to set
    */
   public void setOrderNumber(Long orderNumber)
   {
      this.orderNumber = orderNumber;
   }

   private Collection<AbstractRecordEntry> recordEntryCollection = new HashSet<AbstractRecordEntry>();

   public CSFormContext()
   {

   }

   /**
    * @return the canHaveMultipleRecords
    */
   public Boolean getCanHaveMultipleRecords()
   {
      return false;
      //return canHaveMultipleRecords;
   }

   public CSFormContext(CSFormContext draftCsFormContext, ClinicalStudyEvent csEvent,
         ClinicalStudy publishStudy)
   {
      //      Long formVersionId = ClinicalStudyUtility.getFormVersionId(draftCsFormContext.getContainerId(), null);
      this.setFormLabel(draftCsFormContext.getFormLabel());
      this.setContainerId(draftCsFormContext.getContainerId());
      //   this.setCanHaveMultipleRecords(draftCsFormContext.getCanHaveMultipleRecords());
      this.setActivityStatus(draftCsFormContext.getActivityStatus());
      this.setOrderNumber(draftCsFormContext.getOrderNumber());
      /*this.id = Utility.getPublishedId(CSFormContext.class.getName(), draftCsFormContext.getId(), draftCsFormContext
            .getClinicalStudyEvent().getClinicalStudy().getDraftPublishStudyMappingList());*/

   }

   public Collection<AbstractRecordEntry> getRecordEntryCollection()
   {
      return recordEntryCollection;
   }

   public void setRecordEntryCollection(Collection<AbstractRecordEntry> recordEntryCollection)
   {
      this.recordEntryCollection = recordEntryCollection;
   }

   /**
    * @return the id
    */
   public Long getId()
   {
      return id;
   }

   /**
    * @param id the id to set
    */
   public void setId(Long id)
   {
      this.id = id;
   }

   /**
    * @return the formLabel
    */
   public String getFormLabel()
   {
      return formLabel;
   }

   /**
    * @param formLabel the formLabel to set
    */
   public void setFormLabel(String formLabel)
   {
      this.formLabel = formLabel;
   }

   /**
    * @return the containerId
    */
   public Long getContainerId()
   {
      return containerId;
   }

   /**
    * @param containerId the containerId to set
    */
   public void setContainerId(Long containerId)
   {
      this.containerId = containerId;
   }

   /**
    * @return the activityStatus
    */
   public String getActivityStatus()
   {
      return activityStatus;
   }

   /**
    * @param activityStatus the activityStatus to set
    */
   public void setActivityStatus(String activityStatus)
   {
      this.activityStatus = activityStatus;
   }

}



3. EventFormContext.java
Code:


package edu.wustl.clinportal.domain;

import edu.common.dynamicextensions.domain.nui.UserContext;
import edu.wustl.clinportal.util.global.Utility;

public class EventFormContext extends CSFormContext
{

   /**
    *
    */
   private static final long serialVersionUID = 1L;
   private Boolean canHaveMultipleRecords;
   private Boolean isSkipLogicForm = false;
   private ClinicalStudyEvent clinicalStudyEvent;
   private String processorClass;

   /**
    * @return the processorClass
    */
   public String getProcessorClass()
   {
      return processorClass;
   }

   /**
    * @param processorClass the processorClass to set
    */
   public void setProcessorClass(String processorClass)
   {
      this.processorClass = processorClass;
   }

   public EventFormContext()
   {
   }

   public EventFormContext(EventFormContext draftCSFormContext, ClinicalStudyEvent newCSE,
         UserContext userContext)
   {
      this.setFormLabel(draftCSFormContext.getFormLabel());
      //      this.setContainerId(ClinicalStudyUtility.getFormVersionId(draftCSFormContext.getContainerId(), userContext));
      Long draftFormId = draftCSFormContext.getContainerId();
      //      new VersionedContainerImpl().publishProspective(userContext, draftFormId, new Date());
      this.setContainerId(draftFormId);
      this.setCanHaveMultipleRecords(draftCSFormContext.getCanHaveMultipleRecords());
      this.setIsSkipLogicForm(false);
      this.setClinicalStudyEvent(newCSE);
      this.setOrderNumber(draftCSFormContext.getOrderNumber());
      this.setActivityStatus(draftCSFormContext.getActivityStatus());
      this.id = Utility.getPublishedId(EventFormContext.class.getName(),
            draftCSFormContext.getId(), draftCSFormContext.getClinicalStudyEvent()
                  .getClinicalStudy().getDraftPublishStudyMappingList());
   }

   /**
    * @return the canHaveMultipleRecords
    */
   public Boolean getCanHaveMultipleRecords()
   {
      return canHaveMultipleRecords;
   }

   /**
    * @param canHaveMultipleRecords the canHaveMultipleRecords to set
    */
   public void setCanHaveMultipleRecords(Boolean canHaveMultipleRecords)
   {
      this.canHaveMultipleRecords = canHaveMultipleRecords;
   }

   /**
    * @return the clinicalStudyEvent
    */
   public ClinicalStudyEvent getClinicalStudyEvent()
   {
      return clinicalStudyEvent;
   }

   /**
    * @param clinicalStudyEvent the clinicalStudyEvent to set
    */
   public void setClinicalStudyEvent(ClinicalStudyEvent clinicalStudyEvent)
   {
      this.clinicalStudyEvent = clinicalStudyEvent;
   }

   /**
    * @return the isSkipLogicForm
    */
   public Boolean getIsSkipLogicForm()
   {
      return isSkipLogicForm;
   }

   /**
    * @param isSkipLogicForm the isSkipLogicForm to set
    */
   public void setIsSkipLogicForm(Boolean isSkipLogicForm)
   {
      this.isSkipLogicForm = isSkipLogicForm;
   }
}

Mapping files:

1. clinicalstudyevent.hbm.xml
Code:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

<hibernate-mapping>
    <class
        name="edu.wustl.clinportal.domain.ClinicalStudyEvent"
        table="CATISSUE_CLINICAL_STUDY_EVENT"
        dynamic-update="false"
        dynamic-insert="false"
    >

        <id
            name="id"
            column="IDENTIFIER"
            type="long"
            length="30"
            unsaved-value="null"
        >
            <generator class="native">
                <param name="sequence">CATISSUE_STUDY_EVNT_SEQ</param>
            </generator>
        </id>

        <many-to-one
            name="clinicalStudy"
            class="edu.wustl.clinportal.domain.ClinicalStudy"
            cascade="none"
            outer-join="auto"
            update="true"
            insert="true"
            column="CLINICAL_STUDY_ID"
        />

        <property
            name="collectionPointLabel"
            type="string"
            update="true"
            insert="true"
            column="COLLECTION_POINT_LABEL"
            length="255"
        />

        <property
            name="studyCalendarEventPoint"
            type="int"
            update="true"
            insert="true"
            column="EVENT_POINT"
            length="10"
        />

        <property
            name="noOfEntries"
            type="int"
            update="true"
            insert="true"
            column="NO_OF_ENTRIES"
            length="30"
        />

        <property
            name="activityStatus"
            type="string"
            update="true"
            insert="true"
            column="ACTIVITY_STATUS"
            length="10"
        />

        <property
            name="isInfiniteEntry"
            type="boolean"
            update="true"
            insert="true"
            column="IS_INFINITE_ENTRY"
            length="5"
        />
      <property
            name="relToCPEId"
            type="long"
            update="true"
            insert="true"
            column="REL_CPE_ID"
            length="30"
        />

        <property
            name="isWizardLikeNavigation"
            type="boolean"
            update="true"
            insert="true"
            column="IS_WIZARD_NAVIGATION"
            length="5"
        />
       
              <property
            name="allowDraftSaving"
            type="boolean"
            update="true"
            insert="true"
            column="ALLOW_DRAFT_SAVING"
            length="5"
        />
      
      <property
            name="allowFinalSaving"
            type="boolean"
            update="true"
            insert="true"
            column="ALLOW_FINAL_SAVING"
            length="5"
        />
        <set
            name="eventEntryCollection"
            table="CATISSUE_EVENT_ENTRY"
            lazy="true"
            inverse="true"
            cascade="all"
            sort="unsorted"
        >

              <key
                  column="CLINICAL_STUDY_EVENT_ID"
              />

              <one-to-many
                  class="edu.wustl.clinportal.domain.EventEntry"
              />
        </set>
         <set
            name="clinicalStudyEventFormContextLinkCollection"
            table="CS_EVENT_FORM_CONTEXT_LINK"
            lazy="false"
            inverse="true"
            cascade="all"
            order-by="IDENTIFIER"
        >

              <key
                  column="CLINICAL_STUDY_EVENT_ID"
              />

              <one-to-many
                  class="edu.wustl.clinportal.domain.ClinicalStudyEventFormContextLink"
              />
        </set>
       
      <set
            name="eventFormContexts"
            table="EVENT_FORM_CONTEXT"
            lazy="false"
            inverse="true"
            cascade="all"
            order-by="IDENTIFIER"
        >

              <key
                  column="CLINICAL_STUDY_EVENT_ID"
              />

              <one-to-many
                  class="edu.wustl.clinportal.domain.EventFormContext"
              />
        </set>
       

        <!--
            To add non XDoclet property mappings, create a file named
                hibernate-properties-ClinicalStudyEvent.xml
            containing the additional properties and place it in your merge dir.
        -->
       
      <query name="getStudyEventByLabel">
         from edu.wustl.clinportal.domain.ClinicalStudyEvent
         where  clinicalStudy.shortTitle=:shortTitle and collectionPointLabel = :collectionPointLabel
      </query>

      <query name="getStudyEventByLabelAndCSId">
         from edu.wustl.clinportal.domain.ClinicalStudyEvent
         where  clinicalStudy.id=:clinicalStudyId and collectionPointLabel = :collectionPointLabel
      </query>

      <query name="getEventFormLabels">
         select
            event.id, formCtx.id, event.collectionPointLabel, formCtx.formLabel, formCtx.containerId   
         from
            ClinicalStudyEvent as event inner join event.eventFormContexts as formCtx
         where
            event.id = :eventId   and
            formCtx.id in (:formIds)
      </query>
    </class>
</hibernate-mapping>



2. csformcontext.hbm.xml
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

<hibernate-mapping default-lazy="false">
    <class
        name="edu.wustl.clinportal.domain.CSFormContext"
        table="CS_FORM_CONTEXT"
        dynamic-update="false"
        dynamic-insert="false">
       <id
           name="id"
           column="IDENTIFIER"
           type="long"
           length="19"
           unsaved-value="null">
           <generator class="native">
               <param name="sequence">CS_FORM_CONTEXT_SEQ</param>
           </generator>
       </id>
       <property
           name="formLabel"
           type="string"
           update="true"
           insert="true"
           column="FORM_LABEL"
           length="255"
       />
      <property name="containerId"
      type="long"
      update="true"
      insert="true"
      column="CONTAINER_ID"
      length="30"
      />
      <property
            name="activityStatus"
            type="string"
            update="true"
            insert="true"
            column="ACTIVITY_STATUS"
            length="10"
        />
        <property
            name="orderNumber"
            type="long"
            update="true"
            insert="true"
            column="ORDER_NUMBER"
            length="30"
        />
        <set
            name="recordEntryCollection"
            table="DYEXTN_ABSTRACT_RECORD_ENTRY"
            lazy="true"
            inverse="true"
            cascade="save-update"
            sort="unsorted"
        >

              <key
                  column="ABSTRACT_FORM_CONTEXT_ID"
              />

              <one-to-many
                  class="edu.wustl.clinportal.domain.AbstractRecordEntry"
              />
        </set>
       
        <joined-subclass
         name="edu.wustl.clinportal.domain.EventFormContext"
         table="EVENT_FORM_CONTEXT">
         <key column="IDENTIFIER" />
         
      <property name="canHaveMultipleRecords"
      type="boolean"
      update="true"
      insert="true"
      column="CAN_HAVE_MULTIPLE_RECORDS"
      length="5" />
      
      <property name="isSkipLogicForm"
      type="boolean"
      update="true"
      insert="true"
      column="IS_SKIPLOGIC_FORM"
      not-null="true"
      length="5" />
      
      <property
            name="processorClass"
            type="string"
            update="true"
            insert="true"
            column="PROCESSOR_CLASS"
        />
      
      <many-to-one name="clinicalStudyEvent"
            class="edu.wustl.clinportal.domain.ClinicalStudyEvent" cascade="none"
            update="true" insert="true" column="CLINICAL_STUDY_EVENT_ID"  />
            
      </joined-subclass>
      
      
       <joined-subclass
         name="edu.wustl.clinportal.domain.StudyFormContext"
         table="STUDY_FORM_CONTEXT">
         <key column="IDENTIFIER" />
         
         <many-to-one name="clinicalStudy"
            class="edu.wustl.clinportal.domain.ClinicalStudy" cascade="none"
            update="true" insert="true" column="CLINICAL_STUDY_ID" />
            
      </joined-subclass>
      
</class>
</hibernate-mapping>




Query generated by Hibernate code to fetch collection. If you see the text after 'where' there is no condition for joining EVENT_FORM_CONTEXT and CS_FORM_CONTEXT tables.

Code:
select eventformc0_.CLINICAL_STUDY_EVENT_ID as CLINICAL_STUDY_EVE5_10_0_, eventformc0_.IDENTIFIER as IDENTIFIER1_70_0_,
eventformc0_.IDENTIFIER as IDENTIFIER1_66_1_, eventformc0_1_.FORM_LABEL as FORM_LABEL2_66_1_, eventformc0_1_.CONTAINER_ID as CONTAINER_ID3_66_1_,
eventformc0_1_.ACTIVITY_STATUS as ACTIVITY_STATUS4_66_1_, eventformc0_1_.ORDER_NUMBER as ORDER_NUMBER5_66_1_,
eventformc0_.CAN_HAVE_MULTIPLE_RECORDS as CAN_HAVE_MULTIPLE_2_70_1_, eventformc0_.IS_SKIPLOGIC_FORM as IS_SKIPLOGIC_FORM3_70_1_,
eventformc0_.PROCESSOR_CLASS as PROCESSOR_CLASS4_70_1_, eventformc0_.CLINICAL_STUDY_EVENT_ID as CLINICAL_STUDY_EVE5_70_1_
from EVENT_FORM_CONTEXT eventformc0_,
CS_FORM_CONTEXT eventformc0_1_ where eventformc0_.CLINICAL_STUDY_EVENT_ID=6564 order by eventformc0_.IDENTIFIER;


Is there anything wrong with the configuration or Is this a bug in Hibernate 4.3.11 code.

Any Pointers will be helpful.

Thanks.


Top
 Profile  
 
 Post subject: Re: Hibernate not adding condition for joining sub classes
PostPosted: Thu Mar 03, 2016 2:09 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
I think you should open a JIRA issue and supply a replicating test case.


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.