-->
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.  [ 1 post ] 
Author Message
 Post subject: How can i get the expect type form Proxy Type ?
PostPosted: Wed Oct 08, 2008 3:51 am 
Newbie

Joined: Wed Jul 09, 2008 9:11 pm
Posts: 2
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:1.2.1.400

Mapping documents:
1>Resource.hbm.xml
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="Sample.Resource, Sample" table="TBL_RESOURCE">
<id name="ResourceId">
<generator class="uuid.hex" />
</id>
<property name="ResourceName" />
</class>
</hibernate-mapping>

2>PageResource.hbm.xml
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<joined-subclass name="Sample.PageResource, Sample"
table="TBL_RSR_PAGE" extends="Sample.Resource, Sample">
<key column="ResourceId" />
</joined-subclass>
</hibernate-mapping>

Code between sessionFactory.openSession() and session.close():
//
// I use Spring.Net's NHibernateTemplate to get object as follow:
//
Resource rsr = FindById<Resource>(resourceId);

Full stack trace of any exception that occurs:

Name and version of the database you are using: SqlServer 2005

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Problems with Session and transaction handling?

When the code is running, the rsr get a resource from database.
And it's type is "CProxyTypeSampleResource_NHibernate_ProxyINHibernateProxy_System_Runtime_SerializationISerializable2", it's ToString value is "Sample.PageResource".
rsr.GetType().BaseType is typoof(Resource), not the typeof(PageResource).

How can I get the expected type(PageResource) of rsr?
Read this: http://hibernate.org/42.html


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.