-->
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.  [ 5 posts ] 
Author Message
 Post subject: Property.isLazy() always returns false
PostPosted: Thu Oct 06, 2005 3:58 am 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
org.hibernate.mapping.Property.isLazy() won't return true. Below is a mapping snippet, some java, and logging output .

Code:
      <bag name="lazyAuctionsProperty"
            lazy="true"
            inverse="true"
            cascade="save-update,lock">
         <key column="seller"/>
         <one-to-many class="AuctionItem"/>
      </bag>


Code:
   public String getFetchType(Property property) {
      Value value = property.getValue();
      String fetchType = importType( "javax.persistence.FetchType");
      boolean lazy = false;
      if ( property.isLazy() ) {
         log.info(property.toString() + " is lazy");
         return fetchType + "." + "LAZY";
      }else {
         log.info(property.toString() + " is eager");
         return fetchType + "." + "EAGER";
      }
   }

Code:
INFO: org.hibernate.mapping.Property(lazyAuctionsProperty) is eager


hibernate.jar from JBossIDE-N200509280156-ALL build.


Top
 Profile  
 
 Post subject: Re: Property.isLazy() always returns false
PostPosted: Fri Oct 07, 2005 6:11 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
dennisbyrne wrote:
Code:
   public String getFetchType(Property property) {
      Value value = property.getValue();
      String fetchType = importType( "javax.persistence.FetchType");
      boolean lazy = false;
      if ( property.isLazy() ) {
         log.info(property.toString() + " is lazy");
         return fetchType + "." + "LAZY";
      }else {
         log.info(property.toString() + " is eager");
         return fetchType + "." + "EAGER";
      }
   }

Code:
INFO: org.hibernate.mapping.Property(lazyAuctionsProperty) is eager


I never wrote such a code.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 07, 2005 10:21 am 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
Yes, that was my code - this is no longer an issue for me. I was trying to generate lazy OneToMany rels. I couldn't see how to do this as long as EntityPOJOClass.getFetchType only addressed Property instances of ToOne .

I have not been trying to waste your time.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 10, 2005 4:45 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
I've enhanced getFetchType to handle collections recently.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 10, 2005 1:24 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
thanks. I put some tests in hbx414. you might find the utility methods useful for testing generated annotations.


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