-->
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.  [ 3 posts ] 
Author Message
 Post subject: joined-subclass without left outer join.
PostPosted: Wed Jun 04, 2008 2:11 pm 
Regular
Regular

Joined: Tue Apr 01, 2008 5:39 pm
Posts: 61
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
3.2.5 GA

Mapping documents:
Code:
<joined-subclass name="Customer" extends="security.domain.User" table="CUSTOMER"
       abstract="false">
       <key column="CUSTOMER_ID"/>
       <!-- some stuff afteward -->
</joined subclass>

<joined-subclass name="Agency" extends="security.domain.User" table="AGENCY"
       abstract="false">
       <key column="AGENCY_ID"/>
       <!-- some stuff afteward -->
</joined subclass>

<hibernate-mapping package="security.domain">
  <class name="User" table="CS_USER">
      <id name="id" column="CS_USER_ID" access="field">
          <generator class="sequence">
            <param name="sequence">USER_ID_SEQ</param>
          </generator>
       </id>
      <!-- some stuff afteward -->
  </class>
</hibernate-mapping>


Code between sessionFactory.openSession() and session.close():
Code:
userService.getUserById(1)

Full stack trace of any exception that occurs:


Name and version of database
Oracle 10g

The generated SQL (show_sql=true):
Code:
/* load security.domain.User */ select
user0_.CS_USER_ID as CS1_44_0_,
        user0_.USER_NAME as USER2_44_0_,
        user0_.USER_EMAIL as USER3_44_0_,
        user0_.PASSPHRASE as PASSPHRASE44_0_,
        user0_.USER_STATUS_ID as USER5_44_0_,
        user0_.FIRST_NAME as FIRST6_44_0_,
        user0_.LAST_NAME as LAST7_44_0_,
        user0_.CREATE_USER_ID as CREATE8_44_0_,
        user0_.CREATE_TIME as CREATE9_44_0_,
        user0_.MODIFY_USER_ID as MODIFY10_44_0_,
        user0_.MODIFY_TIME as MODIFY11_44_0_,
        user0_1_.AGENCY_NAME as AGENCY2_55_0_,
        user0_1_.AGENCY_TYPE_ID as AGENCY3_55_0_,
        user0_1_.AGENCY_STATUS_ID as AGENCY4_55_0_,
        user0_1_.CREATE_USER_ID as CREATE5_55_0_,
        user0_1_.CREATE_TIME as CREATE6_55_0_,
        user0_1_.MODIFY_USER_ID as MODIFY7_55_0_,
        user0_1_.MODIFY_TIME as MODIFY8_55_0_,
        user0_1_.DISCOUNT_ID as DISCOUNT9_55_0_,
        user0_2_.BUSINESS_NAME as BUSINESS2_56_0_,
        user0_2_.AFFILIATE_ID as AFFILIATE3_56_0_,
        user0_2_.COMPANY_ID as COMPANY4_56_0_,
        user0_2_.AGENCY_ID as AGENCY5_56_0_,
        user0_2_.CUSTOMER_STATUS_ID as CUSTOMER6_56_0_,
        user0_2_.CREATE_USER_ID as CREATE7_56_0_,
        user0_2_.CUSTOMER_TYPE_ID as CUSTOMER8_56_0_,
        user0_2_.CREATE_TIME as CREATE9_56_0_,
        user0_2_.MODIFY_USER_ID as MODIFY10_56_0_,
        user0_2_.MODIFY_TIME as MODIFY11_56_0_,
        case
            when user0_1_.AGENCY_ID is not null then 1
            when user0_2_.CUSTOMER_ID is not null then 2
            when user0_.CS_USER_ID is not null then 0
        end as clazz_0_
    from
        CS_USER user0_
    left outer join
        AGENCY user0_1_
            on user0_.CS_USER_ID=user0_1_.AGENCY_ID
    left outer join
        CUSTOMER user0_2_
            on user0_.CS_USER_ID=user0_2_.CUSTOMER_ID
    where
        user0_.CS_USER_ID=?


Debug level Hibernate log excerpt:


As you see it is eagerly fetching the subclass when i try to load super class. I don't want thel oad the subclass.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 04, 2008 2:41 pm 
Regular
Regular

Joined: Tue Apr 01, 2008 5:39 pm
Posts: 61
Oh i don't want discriminator column.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 18, 2008 11:11 pm 
Regular
Regular

Joined: Tue Apr 01, 2008 5:39 pm
Posts: 61
bump using 3.2.6 now. I still get unncessay join. Whats a way around this?


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