-->
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.  [ 2 posts ] 
Author Message
 Post subject: Problem with FETCH ALL PROPERTIES for many-to-one properties
PostPosted: Mon Sep 05, 2005 10:37 am 
Newbie

Joined: Fri Sep 02, 2005 9:03 am
Posts: 5
Hibernate version: 3.1beta2

Can anyone clarify me how FETCH ALL PROPERTIES should work
I added following test method to org.hibernate.test.instrument.InstrumentTest and it fails.
Code:
   public void testRealFetchAll() throws Exception {
      Session s = openSession();
      Owner o = new Owner();
      Document doc = new Document();
      Folder fol = new Folder();
      o.setName("gavin");
      doc.setName("Hibernate in Action");
      doc.setSummary("blah");
      doc.updateText("blah blah");
      fol.setName("books");
      doc.setOwner(o);
      doc.setFolder(fol);
      fol.getDocuments().add(doc);
      s.persist(o);
      s.persist(fol);
      s.flush();
      s.clear();
      doc = (Document) s.createQuery("from Document fetch all properties").uniqueResult();
      assertTrue( Hibernate.isPropertyInitialized( doc, "folder" ) );// OK
      assertEquals( doc.getSummary(), "blah" );
      s.flush();
      s.connection().commit();
      s.close();
      try {
         doc.getFolder().getName();
      } catch (LazyInitializationException e) {
         fail ("LazyInitializationException should not be thown");//Failure
      }
      s = openSession();
      s.delete(doc);
      s.delete( doc.getFolder() );
      s.delete( doc.getOwner() );
      s.flush();
      s.connection().commit();
      s.close();
   }


I was sured that FETCH ALL PROPERTIES should initialize properties so they can be accessed outside session.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 05, 2005 11:53 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
fetch all properties has absolutely nothing to do with associations


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