-->
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: How to create Dynamic Proxy from entity class and idValue
PostPosted: Tue Aug 16, 2005 6:23 am 
Newbie

Joined: Fri Oct 17, 2003 10:56 pm
Posts: 11
Code:
public class User {
   ...
   private Address address;
   public Address getAddress() {
      return address;
   }
   public void setAddress(Address address) {
      this.address = address;
   }
   ...
}


public class Address {
   private String addressId ;
   ....
}


and User's address is lazy now.



How can I dynamic create a lazy proxy instance (address) , the proxy can also be persiste in session . just like :

Code:
User user = (User) session.load(User.class, "1");
Address address = ....//dynamic create a lazy proxy by Class and idValue
user.setAddress(address);

Session session = openSession();
session.update(user);
session.close();

....


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 16, 2005 8:16 am 
Expert
Expert

Joined: Sat Oct 25, 2003 8:49 am
Posts: 490
Location: Vrhnika, Slovenia
What?

Is Address an entity too? It must be, in order to use proxies.
Then by default all entities are proxies.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 16, 2005 8:44 pm 
Newbie

Joined: Fri Oct 17, 2003 10:56 pm
Posts: 11
Address is an entity .

look my subject , i want to create proxy by Entity Class (Address.class) and idValue(addressId = '1').


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 16, 2005 11:00 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
session.load() create a cglib-based proxy if the class is proxiable (i.e., is mapped with lazy="true" or proxy="...")...


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.