-->
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.  [ 6 posts ] 
Author Message
 Post subject: can't get connect by oracle native query to work??
PostPosted: Tue Apr 19, 2005 12:28 pm 
Regular
Regular

Joined: Thu Sep 09, 2004 6:46 pm
Posts: 96
The following doesn't seem to work for connect by oracle native sql it does original query as if it were generating query. I tried without table="CONTACT_US_TOPIC_HEADER" and got same result. What do I need to do differently?

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


<hibernate-mapping package="com.bcbsma.contactus.business.domain">

   <class
      name="ContactUsTopicHeader"
      table="CONTACT_US_TOPIC_HEADER"
   >
      <id
         name="id"
         type="integer"
         column="TOPIC_HEADER_ID"
      >
         <generator class="sequence">
              <param name="sequence">CONTACT_US_TOPIC_HEADER_ID_SEQ</param>
            </generator>
      </id>

      <property
         name="topicHeader"
         column="TOPIC_HEADER"
         type="string"
         not-null="true"
         length="255"
      />
      <property
         name="sortOrder"
         column="SORT_ORDER"
         type="integer"
         not-null="true"
         length="22"
      />
      <property
         name="level"
         column="LEVEL"
         type="integer"
         not-null="true"
         length="22"
      />
      <many-to-one
         name="parentTopicHeader"
         column="PARENT_TOPIC_HEADER_ID"
         class="ContactUsTopicHeader"
         not-null="false"
      >
      </many-to-one>
      <many-to-one
         name="topic"
         column="TOPIC_ID"
         class="ContactUsTopic"
         not-null="true"
      >
      </many-to-one>

      <set name="infoLines"
           inverse="true"
           lazy="true"
           cascade="all"
           order-by="SORT_ORDER"
       >
         <key column="TOPIC_HEADER_ID"/>
         <one-to-many class="ContactUsTopicInfo"/>
      </set>
      <loader query-ref="contactUsTopicHeader"/>

   </class>   
   
   <sql-query name="contactUsTopicHeader">
       <return alias="h" class="ContactUsTopicHeader"/>
       select {h.*} from contact_us_topic_header h
        start with parent_topic_header_id is null
      connect by prior topic_header_id=parent_topic_header_id
   </sql-query>
</hibernate-mapping>


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 19, 2005 3:18 pm 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
I think that hibernate doesn't support connect/start with
you can try with native sql or pure jdbc

regards


Top
 Profile  
 
 Post subject: That statement is native sql...
PostPosted: Tue Apr 19, 2005 3:33 pm 
Regular
Regular

Joined: Thu Sep 09, 2004 6:46 pm
Posts: 96
That statement is native sql...


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 19, 2005 7:27 pm 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
I try it with correct class, mappings and tables and your query work (hibernate 3.0)

What is your errors ?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 19, 2005 9:44 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Code:
 
   
   <sql-query name="contactUsTopicHeader">
       <return alias="h" class="ContactUsTopicHeader"/>
       select {h.*} from contact_us_topic_header {h}
        start with parent_topic_header_id is null
      connect by prior topic_header_id=parent_topic_header_id
   </sql-query>



Notice the table alias...


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 19, 2005 9:49 pm 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
I try this (and it work)
Code:
<sql-query name="menusQuery">
      <return alias="menus"
         class="yu.co.snpe.dbtable.model.hibernate.AdmSnpeMenus" />
      select {menus.*} from adm_snpe_menus menus start with pid is
      null connect by prior id=pid
   </sql-query>


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 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.