-->
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.  [ 4 posts ] 
Author Message
 Post subject: Default fetch for many to one
PostPosted: Wed Oct 26, 2005 2:45 am 
Beginner
Beginner

Joined: Fri Jun 17, 2005 7:24 am
Posts: 23
Default fetch for many to one according to manual is "select" but i saw it in console there it use left join. How come? Actually hibernate those lazy and fetching very confuse.


Top
 Profile  
 
 Post subject: Re: Default fetch for many to one
PostPosted: Wed Oct 26, 2005 9:42 am 
Expert
Expert

Joined: Mon Feb 14, 2005 12:32 pm
Posts: 609
Location: Atlanta, GA - USA
why wrote:
Default fetch for many to one according to manual is "select" but i saw it in console there it use left join. How come? Actually hibernate those lazy and fetching very confuse.


What version of Hibernate are you using ? Can you post your mapping files ?

http://www.hibernate.org/ForumMailingli ... AskForHelp

_________________
Preston

Please don't forget to give credit if/when you get helpful information.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 30, 2005 7:27 am 
Beginner
Beginner

Joined: Fri Jun 17, 2005 7:24 am
Posts: 23
Console:
Hibernate: select email0_.emailid as emailid1_, email0_.email as email14_1_, email0_.personid as personid14_1_, person1_.personid as personid0_, person1_.person_name as person2_12_0_ from email email0_ left outer join Person person1_ on email0_.personid=person1_.personid where email0_.emailid=?


Code:
   public void testLoadMany2One() {
      Email email = (Email) session.load(Email.class, 1);
      email.getEmail();

      tx.commit();
      session.close();
   }


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

<hibernate-mapping >

   <class name="hibernateSpring.Email" table="email" >

      <id name="emailID" column="emailid" type="int" unsaved-value="0">
         <generator class="increment" />
      </id>

      <property name="email" column="email" type="java.lang.String" not-null="false" length="20" />

      <many-to-one name="person" class="hibernateSpring.Person" cascade="save-update"
         column="personid"   />
   </class>

</hibernate-mapping>


Top
 Profile  
 
 Post subject: hibernate version is 3.0.5.
PostPosted: Sun Oct 30, 2005 11:16 am 
Beginner
Beginner

Joined: Fri Jun 17, 2005 7:24 am
Posts: 23
The hibernate version is 3.0.5.


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