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: property.GetValue( target, new object[0] ) failing,Need HELP
PostPosted: Tue Aug 29, 2006 12:25 pm 
Newbie

Joined: Tue Aug 29, 2006 9:51 am
Posts: 8
I am executing the following query :
string strQuery = "Select new TbFeedItem(A.Id,A.Title,A.Url,A.Description,A.PublishDate,A.Author,A.Comments,A.CreatedOn,B.Id) from TbFeedItem A left join A.TbUserFeedActivityList B where (B.UserActivityid=" + ((int)UserActivity.ReadItem).ToString() + " or B.UserActivityid is null) and A.FeedLibid=" + Subscription.FeedLibid.Id.ToString();
strQuery += " and A.CreatedOn > '" + strLastPurgeDate + "'";
strQuery += " and A.CreatedOn <= '" + Subscription.UpdatedOn.Date.ToShortDateString() + "'";
strQuery += " Order by PublishDate desc";

NOTE: Above code works from one workflow, but fails from another
========================================

I am using nhibernate-1.0.2.0
========================================
I get error at this method (in basicgetter.cs):
public object Get( object target )
{
try
{
return property.GetValue( target, new object[0] );
}
catch( Exception e )
{
throw new PropertyAccessException( e, "Exception occurred", false, clazz, propertyName );
}
}

Now here the clazz is (clazz var where PropertyAccessException exception is being thrown):
{Name = "TbFolder" FullName = "DomainManager.BusinessObjects.TbFolder"}
----
propertyName:
"id"
----
target paaesed to this "Get" method is:
{DomainManager.BusinessObjects.TbFeedSubscription}

========================================
below is the error:
Object does not match target type.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Reflection.TargetException: Object does not match target type.

Source Error:


Line 39: try
Line 40: {
Line 41: return property.GetValue( target, new object[0] );
Line 42: }
Line 43: catch( Exception e )


Source File: C:\Project\KWL\Code\NHibernate\Property\BasicGetter.cs Line: 41

Stack Trace:


[TargetException: Object does not match target type.]
System.Reflection.RuntimeMethodInfo.CheckConsistency(Object target) +2330437
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +114
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +29
System.Reflection.RuntimePropertyInfo.GetValue(Object obj, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture) +55
System.Reflection.RuntimePropertyInfo.GetValue(Object obj, Object[] index) +18
NHibernate.Property.BasicGetter.Get(Object target) in C:\Project\KWL\Code\NHibernate\Property\BasicGetter.cs:41

[PropertyAccessException: Exception occurred getter of DomainManager.BusinessObjects.TbFolder.Id]
NHibernate.Property.BasicGetter.Get(Object target) in C:\Project\KWL\Code\NHibernate\Property\BasicGetter.cs:45
NHibernate.Persister.AbstractEntityPersister.GetIdentifier(Object obj) in C:\Project\KWL\Code\NHibernate\Persister\AbstractEntityPersister.cs:304
NHibernate.Proxy.NHibernateProxyHelper.GetIdentifier(Object obj, IClassPersister persister) in C:\Project\KWL\Code\NHibernate\Proxy\NHibernateProxyHelper.cs:64
NHibernate.Type.EntityType.ToString(Object value, ISessionFactoryImplementor factory) in C:\Project\KWL\Code\NHibernate\Type\EntityType.cs:85
NHibernate.Type.PersistentCollectionType.ToString(Object value, ISessionFactoryImplementor factory) in C:\Project\KWL\Code\NHibernate\Type\PersistentCollectionType.cs:82
NHibernate.Impl.Printer.ToString(Object entity) in C:\Project\KWL\Code\NHibernate\Impl\Printer.cs:45
NHibernate.Impl.Printer.ToString(IEnumerator enumerator) in C:\Project\KWL\Code\NHibernate\Impl\Printer.cs:94
NHibernate.Impl.SessionImpl.FlushEverything() in C:\Project\KWL\Code\NHibernate\Impl\SessionImpl.cs:2889
NHibernate.Impl.SessionImpl.AutoFlushIfRequired(ISet querySpaces) in C:\Project\KWL\Code\NHibernate\Impl\SessionImpl.cs:2108
NHibernate.Impl.SessionImpl.GetQueries(String query, Boolean scalar) in C:\Project\KWL\Code\NHibernate\Impl\SessionImpl.cs:1780
NHibernate.Impl.SessionImpl.Find(String query, QueryParameters parameters) in C:\Project\KWL\Code\NHibernate\Impl\SessionImpl.cs:1735
NHibernate.Impl.QueryImpl.List() in C:\Project\KWL\Code\NHibernate\Impl\QueryImpl.cs:27
DomainManager.FeedsManager.GetFeedItemList(TbFeedSubscription Subscription, FeedItemSortOrder SortOrder) in C:\Project\KWL\Code\DomainManager\DomainManager\NonPersistant\FeedsManager.cs:197
DomainManager.FeedsManager.GetFeedItemList(Int32 SubscriptionID, FeedItemSortOrder SortOrder) in C:\Project\KWL\Code\DomainManager\DomainManager\NonPersistant\FeedsManager.cs:236
RSS_Feeds.WucFeedListEx1_GetDataItem(Object sender, RssEventArgs e) in c:\Project\KWL\Code\AI\RSS\Feeds.aspx.cs:244
FeedControl.Controls_wucFeedListEx.dlMain_ItemDataBound(Object sender, DataListItemEventArgs e) in c:\Project\KWL\Code\AI\Controls\wucFeedListEx.ascx.cs:191
System.Web.UI.WebControls.DataList.OnItemDataBound(DataListItemEventArgs e) +96
System.Web.UI.WebControls.DataList.CreateItem(Int32 itemIndex, ListItemType itemType, Boolean dataBind, Object dataItem) +172
System.Web.UI.WebControls.DataList.CreateControlHierarchy(Boolean useDataSource) +792
System.Web.UI.WebControls.BaseDataList.OnDataBinding(EventArgs e) +75
System.Web.UI.WebControls.BaseDataList.DataBind() +86
FeedControl.Controls_wucFeedListEx.LoadData() in c:\Project\KWL\Code\AI\Controls\wucFeedListEx.ascx.cs:421
FeedControl.Controls_wucFeedListEx.LoadData(Int32 intMode) in c:\Project\KWL\Code\AI\Controls\wucFeedListEx.ascx.cs:428
RSS_Feeds.DisplayFirstFolderContents() in c:\Project\KWL\Code\AI\RSS\Feeds.aspx.cs:152
RSS_Feeds.FeedInit() in c:\Project\KWL\Code\AI\RSS\Feeds.aspx.cs:93
RSS_Feeds.PageLoadEvent(Object sender, EventArgs e) in c:\Project\KWL\Code\AI\RSS\Feeds.aspx.cs:58
CPageBase.Page_Load(Object sender, EventArgs e) in c:\Project\KWL\Code\AI\App_Code\Common\CPageBase.cs:92
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +31
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +68
System.Web.UI.Control.OnLoad(EventArgs e) +88
System.Web.UI.Control.LoadRecursive() +74
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3035

========================================
Below is the mapping files:
========================================
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="DomainManager.BusinessObjects.TbFeedItem,DomainManager.BusinessObjects" table="TB_FeedItem">

<id name="Id" column="ID" type="Int32" unsaved-value="0">
<generator class="native"/>
</id>
<bag name="TbUserFeedActivityList" inverse="true" lazy="true" >
<key column="FeedItemID" />
<one-to-many class="DomainManager.BusinessObjects.TbUserFeedActivity,DomainManager.BusinessObjects" />
</bag>

<many-to-one name="FeedLibid" column="FeedLibID" class="DomainManager.BusinessObjects.TbFeedLibrary,DomainManager.BusinessObjects" />
<property column="Title" type="String" name="Title" length="1000" />
<property column="URL" type="String" name="Url" length="500" />
<property column="Description" type="String" name="Description" length="2147483647" />
<property column="PublishDate" type="DateTime" name="PublishDate" />
<property column="Author" type="String" name="Author" length="1000" />
<property column="Comments" type="String" name="Comments" length="1000" />
<property column="CreatedOn" type="DateTime" name="CreatedOn" />

</class>
</hibernate-mapping>
==============================================
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="DomainManager.BusinessObjects.TbFeedLibrary,DomainManager.BusinessObjects" table="TB_FeedLibrary">

<id name="Id" column="ID" type="Int32" unsaved-value="0">
<generator class="native"/>
</id>
<bag name="TbFeedItemList" inverse="true" lazy="true" cascade="all" order-by="PublishDate desc" >
<key column="FeedLibID" />
<one-to-many class="DomainManager.BusinessObjects.TbFeedItem,DomainManager.BusinessObjects" />
</bag>

<bag name="TbFeedSubscriptionList" inverse="true" lazy="true" >
<key column="FeedLibID" />
<one-to-many class="DomainManager.BusinessObjects.TbFeedSubscription,DomainManager.BusinessObjects" />
</bag>

<bag name="TbActiveFeedSubscriptionList" inverse="true" lazy="true" where ="Status=1" >
<key column="FeedLibID" />
<one-to-many class="DomainManager.BusinessObjects.TbFeedSubscription,DomainManager.BusinessObjects" />
</bag>

<property column="Title" type="String" name="Title" length="1000" />
<property column="URL" type="String" name="Url" length="500" />
<property column="Description" type="String" name="Description" length="2147483647" />
<many-to-one name="Folderid" column="FolderID" class="DomainManager.BusinessObjects.TbFolder,DomainManager.BusinessObjects" />
<property column="CreatedOn" type="DateTime" name="CreatedOn" />
<property column="UpdatedOn" type="DateTime" name="UpdatedOn" />
<property column="Status" type="Int32" name="Status" />
<property column="PublishDate" type="DateTime" name="PublishDate" />
<property column="TotalFeedCount" type="Int32" name="TotalFeedCount" />
<property column="LastFeedCount" type="Int32" name="LastFeedCount" />
<property column="ImageURL" type="String" name="ImageURL" length="500" />
<property column="Custom" type="Boolean" name="Custom" />
<property column="Flag" type="Int32" name="Flag" />

</class>
</hibernate-mapping>
=========================================
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="DomainManager.BusinessObjects.TbFeedSubscription,DomainManager.BusinessObjects" table="TB_FeedSubscription">

<id name="Id" column="ID" type="Int32" unsaved-value="0">
<generator class="native"/>
</id>

<bag name="TbUserActivityList" lazy="true" cascade ="all" >
<key column="SubsFeedID" />
<one-to-many class="DomainManager.BusinessObjects.TbUserFeedActivity,DomainManager.BusinessObjects" />
</bag>

<many-to-one name="FeedLibid" column="FeedLibID" class="DomainManager.BusinessObjects.TbFeedLibrary,DomainManager.BusinessObjects" />
<many-to-one name="Userid" column="UserID" class="DomainManager.BusinessObjects.AspnetUsers,DomainManager.BusinessObjects" />
<many-to-one name="Folderid" column="FolderID" class="DomainManager.BusinessObjects.TbFolder,DomainManager.BusinessObjects" />
<property column="SubscribedOn" type="DateTime" name="SubscribedOn" />
<property column="Status" type="Int32" name="Status" />
<property column="CreatedOn" type="DateTime" name="CreatedOn" />
<property column="UpdatedOn" type="DateTime" name="UpdatedOn" />
<property column="PurgeSchedule" type="Int32" name="PurgeSchedule" />
<property column="UpdateSchedule" type="Int32" name="UpdateSchedule" />
<property column="Custom" type="Boolean" name="Custom" />
<property column="FeedCount" type="Int32" name="FeedCount" />

</class>
</hibernate-mapping>
===============================================
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="DomainManager.BusinessObjects.TbFolder,DomainManager.BusinessObjects" table="TB_Folder">

<id name="Id" column="ID" type="Int32" unsaved-value="0">
<generator class="native"/>
</id>

<bag name="TbFolderList" lazy="true" cascade="all">
<key column="ParentID" />
<one-to-many class="DomainManager.BusinessObjects.TbFolder,DomainManager.BusinessObjects" />
</bag>

<bag name="TbFeedSubscriptionList" inverse="true" lazy="true" cascade ="all" >
<key column="FolderID" />
<one-to-many class="DomainManager.BusinessObjects.TbFeedSubscription,DomainManager.BusinessObjects" />
</bag>

<bag name="TbFeedLibraryList" inverse="true" lazy="true" cascade ="all">
<key column="FolderID" />
<one-to-many class="DomainManager.BusinessObjects.TbFeedLibrary,DomainManager.BusinessObjects" />
</bag>

<bag name="TbReportList" inverse="true" lazy="true" cascade="all">
<key column="Folder_Id" />
<one-to-many class="DomainManager.BusinessObjects.TbReport,DomainManager.BusinessObjects" />
</bag>



<bag name="TbSearchAlertsList" inverse="true" lazy="true" >
<key column="FolderID" />
<one-to-many class="DomainManager.BusinessObjects.TbSearchAlerts,DomainManager.BusinessObjects" />
</bag>

<bag name="TbKitList" inverse="true" lazy="true" cascade="all">
<key column="FolderID" />
<one-to-many class="DomainManager.BusinessObjects.TbKit,DomainManager.BusinessObjects" />
</bag>


<many-to-one name="Userid" column="UserID" class="DomainManager.BusinessObjects.AspnetUsers,DomainManager.BusinessObjects" />
<property column="FolderName" type="String" name="FolderName" length="400" />
<property column="Description" type="String" name="Description" length="1000" />
<property column="CreatedOn" type="DateTime" name="CreatedOn" />
<many-to-one name="EntityTypeid" column="EntityTypeID" class="DomainManager.BusinessObjects.TbEntityType,DomainManager.BusinessObjects" />
<many-to-one name="Parentid" column="ParentID" class="DomainManager.BusinessObjects.TbFolder,DomainManager.BusinessObjects" />
<property column="IsFolder" type="Boolean" name="IsFolder" />
<property column="EntityObjectID" type="Int32" name="EntityObjectid" />
<property column="NavigateURL" type="String" name="NavigateURL" length="500" />
<property column="Flag" type="Int32" name="Flag" />

</class>
</hibernate-mapping>
===============================================
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="DomainManager.BusinessObjects.TbUserFeedActivity,DomainManager.BusinessObjects" table="TB_UserFeedActivity">

<id name="Id" column="ID" type="Int32" unsaved-value="0">
<generator class="native"/>
</id>

<many-to-one name="FeedItemid" column="FeedItemID" class="DomainManager.BusinessObjects.TbFeedItem,DomainManager.BusinessObjects" />
<property column="UserActivityID" type="Int32" name="UserActivityid" />
<property column="SubsFeedID" type="Int32" name="SubsFeedid" />
<property column="UserID" type="Guid" name="Userid" />

</class>
</hibernate-mapping>
===============================================

Thanks in Advance


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 30, 2006 11:26 am 
Newbie

Joined: Tue Aug 29, 2006 9:51 am
Posts: 8
Actually calls fails in
SessionImpl -> FlushEverything() at line (in bold below)

private void FlushEverything()
{
log.Debug( "flushing session" );

interceptor.PreFlush( entitiesByKey.Values );

PreFlushEntities();

// We could move this inside if we wanted to
// tolerate collection initializations during
// collection dirty checking:
PreFlushCollections();

// Now, any collections that are initialized
// inside this block do not get updated - they
// are ignored until the next flush
flushing = true;
try
{
FlushEntities();
FlushCollections();
}
finally
{
flushing = false;
}

//some stats

if( log.IsDebugEnabled )
{
log.Debug( "Flushed: " +
insertions.Count + " insertions, " +
updates.Count + " updates, " +
deletions.Count + " deletions to " +
entityEntries.Count + " objects" );
log.Debug( "Flushed: " +
collectionCreations.Count + " (re)creations, " +
collectionUpdates.Count + " updates, " +
collectionRemovals.Count + " removals to " +
collectionEntries.Count + " collections" );

new Printer( factory ).ToString( entitiesByKey.Values.GetEnumerator() );
}
}


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.