-->
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: Sequce Generator in multiple schemas
PostPosted: Mon Dec 15, 2014 8:56 am 
Newbie

Joined: Mon Dec 15, 2014 5:36 am
Posts: 2
Hi,

I have a problem persisting a composit of my super class when persisting data with the subclass instance. Both my parent class and the composit reside in one schema. My sublass a different schema. When i save the subclass (+ parent without composit (comments) ) it saves without a hitch but when i add the composit. Hibernate cannot find the sequence generator for the composit.

Thanks in advance for the assitence.

Subclass hbm file:

Code:
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping schema="core" default-access="field" default-lazy="false">
   <class name="za.co.fnb.card.sharedkernel.domain.cases.Case" schema="core" table="case">
      <id name="id" type="long">
          <generator class="sequence">
             <param name="sequence">seq_case_id</param>
          </generator>
      </id>
      <version generated="never" name="version" type="integer"/>
      <property name="createdDate" type="timestamp">
          <column name="created_date" not-null="true"/>
      </property>
     
      <property name="createdByChannel" column="created_by_channel" type="string"/>
     <property name="createdByRef" column="created_by_ref" type="string"/>
       
      <property name="className" type="string">
          <column name="class_name" not-null="true"/>
      </property>      
      <property name="customerId" type="long">
          <column name="customer_id"/>
      </property>
     <property lazy="false" name="company">
         <column name="company" not-null="true"/>
        <type name="org.hibernate.type.EnumType">
            <param name="type">12</param>
            <param name="enumClass">za.co.fnb.card.sharedkernel.domain.Company</param>
        </type>
     </property>
      <property name="status" type="string">
          <column name="status"/>
      </property>      
      <set cascade="all" fetch="join" name="statusHistory" sort="natural" order-by="created_date desc">
          <key foreign-key="fk_case_status">
             <column name="case_id"/>
          </key>
          <one-to-many class="za.co.fnb.card.sharedkernel.domain.cases.CaseStatus"/>
      </set>
     
     <bag name="supportingDocuments" cascade="all" lazy="false">
          <key  foreign-key="fk_case_supporting_document">
             <column name="case_id"/>
          </key>
          <one-to-many class="za.co.fnb.card.sharedkernel.domain.cases.SupportingDocument" />
      </bag>
      <set cascade="all" fetch="join" name="contactHistory" sort="natural" order-by="contacted_date desc">
          <key foreign-key="fk_case_contact">
             <column name="case_id"/>
          </key>
          <one-to-many class="za.co.fnb.card.sharedkernel.domain.cases.Contact"/>
      </set>
      <set cascade="all" lazy="false" name="reminders" sort="unsorted">
          <key foreign-key="fk_case_reminder">
             <column name="case_id"/>
          </key>
          <one-to-many class="za.co.fnb.card.sharedkernel.domain.cases.Reminder"/>
      </set>
      <set cascade="all" lazy="false" name="comments" sort="natural" order-by="created_date desc">
          <key foreign-key="fk_case_comment">
             <column name="case_id"/>
          </key>
          <one-to-many class="za.co.fnb.card.sharedkernel.domain.cases.Comment"/>
      </set>
     
      <joined-subclass name="za.co.fnb.card.sharedkernel.domain.cases.AdhocCase" schema="core" table="adhoc_case">
         <key column="case_id"/> 

         <set cascade="all,delete-orphan" lazy="false" name="tasks" sort="natural" order-by="created_date desc">
             <key foreign-key="fk_case_task">
                <column name="case_id"/>
             </key>
             <one-to-many class="za.co.fnb.card.sharedkernel.domain.Task"/>
         </set>

          <joined-subclass name="za.co.fnb.card.delivery.domain.cases.DeliveryCase" table="delivery.delivery_case">
              <key column="case_id"/>
              <property name="plasticId" type="long">
                <column name="plastic_id" not-null="true" />
             </property>
              <property name="brand">
                  <column name="brand" />
                  <type name="org.hibernate.type.EnumType">
                      <param name="type">12</param>
                      <param name="enumClass">za.co.fnb.card.sharedkernel.domain.banking.Brand</param>
                  </type>
              </property>
          </joined-subclass>

     </joined-subclass>

   </class>
</hibernate-mapping>




Problems arise when i add comment.


Top
 Profile  
 
 Post subject: Re: Sequce Generator in multiple schemas
PostPosted: Wed Dec 17, 2014 2:54 am 
Newbie

Joined: Mon Dec 15, 2014 5:36 am
Posts: 2
Hi, i managed to find an old solution for my problem. It seems like hibernate totally ignores the schema defenitions in the hbm files and uses the default schema as defined in the hbm file. Nonetheless, giving the sequence generator a fully qualified sequence name in the hbm file fixed my problem.


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.