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.  [ 3 posts ] 
Author Message
 Post subject: many-to-one property return null object after Save()
PostPosted: Thu Sep 06, 2007 5:17 am 
Newbie

Joined: Wed Aug 08, 2007 8:55 am
Posts: 9
From Imovel Class
<many-to-one name="Leilao" class="Leilao" column="LeilaoId" />

From Leilao Class
<set name="Imoveis" inverse="true" lazy="true">
<key column="LeilaoId" />
<one-to-many class="Imovel" />
</set>

When I save an Imovel, I use Server.Transfer() to send the user to the Leilao listing, the problem is the Leilao corresponding to the previous Save() returns a strange behaviour, since the class variables have null values but the class Properties have the correct values.

The Gridview I load the List<Leilao> throws the following exception:

Code:
[TargetException: Object does not match target type.]
   System.Reflection.RuntimeMethodInfo.CheckConsistency(Object target) +2330037
   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.MethodBase.Invoke(Object obj, Object[] parameters) +17
   System.ComponentModel.ReflectPropertyDescriptor.GetValue(Object component) +151

[TargetInvocationException: Property accessor 'Id' on object 'Leilao' threw the following exception:'Object does not match target type.']
   System.ComponentModel.ReflectPropertyDescriptor.GetValue(Object component) +498
   System.Web.UI.WebControls.BoundField.GetValue(Control controlContainer) +427
   System.Web.UI.WebControls.BoundField.OnDataBindField(Object sender, EventArgs e) +118
   System.Web.UI.Control.OnDataBinding(EventArgs e) +88
   System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +167
   System.Web.UI.Control.DataBind() +31
   System.Web.UI.Control.DataBindChildren() +236
   System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +178
   System.Web.UI.Control.DataBind() +31
   System.Web.UI.WebControls.GridView.CreateRow(Int32 rowIndex, Int32 dataSourceIndex, DataControlRowType rowType, DataControlRowState rowState, Boolean dataBind, Object dataItem, DataControlField[] fields, TableRowCollection rows, PagedDataSource pagedDataSource) +199
   System.Web.UI.WebControls.GridView.CreateChildControls(IEnumerable dataSource, Boolean dataBinding) +4309
   System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +89
   System.Web.UI.WebControls.GridView.PerformDataBinding(IEnumerable data) +38
   System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +111
   System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +98
   System.Web.UI.WebControls.DataBoundControl.PerformSelect() +154
   System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +99
   System.Web.UI.WebControls.GridView.DataBind() +23
   ListagemLeiloes.Page_Load(Object sender, EventArgs e) in ListagemLeiloes.aspx.cs:39
   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) +3042


Any idea?

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 06, 2007 6:43 am 
Newbie

Joined: Wed Aug 08, 2007 8:55 am
Posts: 9
Related with this:

http://www.nablasoft.com/Alkampfer/?p=78


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 06, 2007 9:35 am 
Newbie

Joined: Wed Aug 08, 2007 8:55 am
Posts: 9
solved with:

<class ..... lazy="false" >
</class>


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