-->
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 with lazy="true"
PostPosted: Tue Aug 31, 2004 6:28 am 
Newbie

Joined: Fri Aug 06, 2004 9:44 am
Posts: 3
Hibernate version:3.0alpha
I read in changelog for hibernate 3.0alpha:
<changelog>
* added lazy="true" to property mappings
</changelog>.
But in my tests it doesn't work. I have mapping like this:
<property name="description" lazy="true" access="field"/>
but the 'description' field is in the select with all other fields (it is not excluded from 'eager' select). Is it a bug ? Or Hibernate Team only added 'lazy' in DTD and not implemented it yet ?


PG


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 31, 2004 7:26 am 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
have you tried this using session.load()? or via hql query?

_________________
Anthony,
Get value thanks to your skills: http://www.redhat.com/certification


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 31, 2004 7:51 am 
Newbie

Joined: Fri Aug 06, 2004 9:44 am
Posts: 3
I've tried Query and Criteria interfaces and Session.load(). For every solution it seems to work the same - eager fetching of lazy fields. Maybe there is some property to set in configuration ?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 31, 2004 8:04 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Did you run the bytecode enhancer?? I am sure this is in the docs...


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 31, 2004 2:04 pm 
Newbie

Joined: Fri Aug 06, 2004 9:44 am
Posts: 3
gavin wrote:
Did you run the bytecode enhancer?? I am sure this is in the docs...

Sorry, I was convinced that Hibernate only uses runtime bytecode manipulation ... OK, my fault. But this is what happend with enhanced code:

java.lang.ArrayIndexOutOfBoundsException: 0
at org.hibernate.persister.BasicEntityPersister.createSelect(BasicEntityPersister.java:2022)
at org.hibernate.persister.BasicEntityPersister.renderSelect(BasicEntityPersister.java:2060)
at org.hibernate.persister.BasicEntityPersister.generateLazySelectString(BasicEntityPersister.java:551)
at org.hibernate.persister.BasicEntityPersister.postInstantiate(BasicEntityPersister.java:2118)
at org.hibernate.persister.SingleTableEntityPersister.postInstantiate(SingleTableEntityPersister.java:367)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:200)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:914)
at nabor.Main.showMappingInfo(Main.java:87)
at nabor.Main.init(Main.java:80)
at nabor.Main.main(Main.java:223)

My mapping looks like this:

<hibernate-mapping>
<class name="LazyTest" table="lazy_tests">
<id name="ltId" unsaved-value="null" access="field">
<generator class="sequence">
<param name="sequence">lazy_test_id_seq</param>
</generator>
</id>
<property name="name" access="field"/>
<property name="description" lazy="true" access="field"/>
</class>
</hibernate-mapping>
In debbuger I can see, that SingleTableEntityPersister.subclassFormulaTableNumberClosure is 0-length array.
However subclassPropertyFormulaNumberClosure is an array of 1-legth int arrays. subclassFormulaTableNumberClosure is iterated in createSelect() according to array collected in generateLazySelectString() using subclassPropertyFormulaNumberClosure field, which causes an exception. I hope that it helps.

PG


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.