-->
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: getClassMetadata(..) returns null
PostPosted: Wed May 26, 2004 8:45 am 
Beginner
Beginner

Joined: Wed Sep 24, 2003 11:06 am
Posts: 21
Location: Denmark
Using Hibernate 2.1.2, im getting nulls from getClassMetadata(x) where x is the proxy of an entity class..

I have 2 questions:

1: The API doc says nothing about this method returning nulls, but it does say it throws HibernateException... In which cases does what happen?

2: How do i get the metadata for an entity class, for which i only have a proxy object? Is there a way to get the class of the underlying object from the proxy object?

regards,
Jesper

_________________
Hibernate rocks!


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 26, 2004 8:56 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Hibernate.getClass(proxyObject)


Top
 Profile  
 
 Post subject: Hibernate.getClass(x)
PostPosted: Wed May 26, 2004 9:02 am 
Beginner
Beginner

Joined: Wed Sep 24, 2003 11:06 am
Posts: 21
Location: Denmark
Ok, didnt see that one...

my problem now is, I'm not within a session and i'm definately not within the session where the proxy was loaded, and therefore I get LazyInitializationException.. I'm sure there must be a way to get the class of the original object without having to rely on the original session!?

Also, does Hibernate.getClass(x) also work, where x is not a proxy?

_________________
Hibernate rocks!


Top
 Profile  
 
 Post subject: Re: Hibernate.getClass(x)
PostPosted: Wed May 26, 2004 9:11 am 
Beginner
Beginner

Joined: Wed Sep 24, 2003 11:06 am
Posts: 21
Location: Denmark
hooverphonique wrote:
Ok, didnt see that one...

my problem now is, I'm not within a session and i'm definately not within the session where the proxy was loaded, and therefore I get LazyInitializationException.. I'm sure there must be a way to get the class of the original object without having to rely on the original session!?

Also, does Hibernate.getClass(x) also work, where x is not a proxy?


Ok, I found the answer: use HibernateProxyHelper.getClass(x) where x is an entity or entity proxy...

_________________
Hibernate rocks!


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.