-->
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.  [ 5 posts ] 
Author Message
 Post subject: Persister.GetSetHelperFactory - Compiled with error
PostPosted: Wed Jan 10, 2007 11:01 am 
Newbie

Joined: Wed Jan 10, 2007 10:25 am
Posts: 3
Used Hybernate Version: 1.0.3.0

Mapping documents:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0" assembly="Omis.Core" namespace="Omis.Core.Domain">
   <class name="TModules" table="t_Modules">

      <id name="Modulid" column="ModulID" type="Int32" unsaved-value="0">
         <generator class="native"/>
      </id>
      <bag name="TCustomerModulsList" inverse="true" lazy="true" >
         <key column="ModulID" />
         <one-to-many class="TCustomerModuls" />
      </bag>
      <bag name="TVisMaskList" inverse="true" lazy="true" >
         <key column="ModulID" />
         <one-to-many class="TVisMask" />
      </bag>
      <property column="Description" type="String" name="Description" length="30" />
      
   </class>
</hibernate-mapping>


created Class File:

Code:
using System;
using System.Collections.Generic;


namespace Omis.Core.Domain
{
   [Serializable]
   public class TModules: IEquatable<TModules>
   {

      #region Private Members

      private int _modulid;
      private IList<TCustomerModuls> _TCustomerModulsList;
      private IList<TVisMask> _TVisMaskList;
      private string _description;       
      #endregion

      #region Constructor

      public TModules()
      {
         _modulid = 0;
         _TCustomerModulsList = new List<TCustomerModuls>();
         _TVisMaskList = new List<TVisMask>();
         _description = String.Empty;
      }
      #endregion // End of Default ( Empty ) Class Constuctor

      #region Required Fields Only Constructor
      /// <summary>
      /// required (not null) fields only constructor
      /// </summary>
      public TModules(
         int modulid)
         : this()
      {
         _modulid = modulid;
         _description = String.Empty;
      }
      #endregion // End Constructor

      #region Public Properties
         
      public virtual int Modulid
      {
         get
         {
            return _modulid;
         }
         set
         {
            _modulid = value;
         }

      }
         
      public virtual IList<TCustomerModuls> TCustomerModulsList
      {
         get
         {
            return _TCustomerModulsList;
         }
         set
         {
            _TCustomerModulsList = value;
         }
      }

      public virtual IList<TVisMask> TVisMaskList
      {
         get
         {
            return _TVisMaskList;
         }
         set
         {
            _TVisMaskList = value;
         }
      }

      public virtual string Description
      {
         get
         {
            return _description;
         }

         set   
         {   
            if(  value != null &&  value.Length > 30)
               throw new ArgumentOutOfRangeException("Invalid value for Description", value, value.ToString());
            
            _description = value;
         }
      }
         
            
      #endregion

      #region Public Functions

      public virtual void AddTCustomerModuls(TCustomerModuls obj)
      {
         #region Check if null
         if (obj == null)
            throw new ArgumentNullException("obj", "El parametro no puede ser nulo");
         #endregion
         _TCustomerModulsList.Add(obj);
      }
      

      public virtual void AddTVisMask(TVisMask obj)
      {
         #region Check if null
         if (obj == null)
            throw new ArgumentNullException("obj", "El parametro no puede ser nulo");
         #endregion
         _TVisMaskList.Add(obj);
      }
      

      #endregion //Public Functions

      #region Equals And HashCode Overrides
      /// <summary>
      /// local implementation of Equals based on unique value members
      /// </summary>
      public override bool Equals( object obj )
      {
         if( this == obj ) return true;
         if( ( obj == null ) || ( obj.GetType() != this.GetType() ) ) return false;
         TModules castObj = (TModules)obj;
         return ( castObj != null ) &&
            ( this._modulid == castObj.Modulid );
      }
      
      /// <summary>
      /// local implementation of GetHashCode based on unique value members
      /// </summary>
      public override int GetHashCode()
      {
         
         int hash = 57;
         hash = 27 ^ hash ^ _modulid.GetHashCode();
         return hash;
      }
      #endregion
      
      #region IEquatable members

      public bool Equals(TModules other)
      {
         if (other == this)
            return true;
      
         return ( other != null ) &&
            ( this._modulid == other.Modulid );
               
      }

      #endregion
      
   }
}



When i start the application the following logfile is created:

13:27:10.062 [3060] DEBUG NHibernate.Persister.GetSetHelperFactory - Init compiler for class Omis.Core.Domain.TModules
13:27:10.062 [3060] DEBUG NHibernate.Persister.GetSetHelperFactory - Adding referenced assembly C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\omis.web\e2d6b9a9\85e093ae\assembly\dl3\e0574ba5\123685ac_c1f1c601\NHibernate.DLL
13:27:10.062 [3060] DEBUG NHibernate.Persister.GetSetHelperFactory - Adding referenced assembly C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\omis.web\e2d6b9a9\85e093ae\assembly\dl3\8beb12ab\94ff0f84_b234c701\Omis.Core.DLL
13:27:10.062 [3060] DEBUG NHibernate.Persister.GetSetHelperFactory - Adding referenced assembly C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll
13:27:10.062 [3060] DEBUG NHibernate.Persister.GetSetHelperFactory - Adding referenced assembly C:\WINDOWS\assembly\GAC_32\System.Data\2.0.0.0__b77a5c561934e089\System.Data.dll
13:27:10.062 [3060] DEBUG NHibernate.Persister.GetSetHelperFactory - Adding referenced assembly C:\WINDOWS\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll
13:27:10.062 [3060] DEBUG NHibernate.Persister.GetSetHelperFactory - Adding referenced assembly C:\WINDOWS\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.dll
13:27:10.062 [3060] DEBUG NHibernate.Persister.GetSetHelperFactory - Adding referenced assembly C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\omis.web\e2d6b9a9\85e093ae\assembly\dl3\e3613a64\ae4c6d5a_1efcc601\Omis.Data.DLL
13:27:10.156 [3060] DEBUG NHibernate.Persister.GetSetHelperFactory - Compiled with error:
using System;
using NHibernate.Property;
namespace NHibernate.Persister {
public class GetSetHelper_Omis_Core_Domain_TModules : IGetSetHelper {
ISetter[] setters;
IGetter[] getters;
public GetSetHelper_Omis_Core_Domain_TModules(ISetter[] setters, IGetter[] getters) {
this.setters = setters;
this.getters = getters;
}
public void SetPropertyValues(object obj, object[] values) {
Omis.Core.Domain.TModules t = (Omis.Core.Domain.TModules)obj;
try
{
t.Description = (System.String)values[0];
t.TCustomerModulsList = (System.Collections.Generic.IList`1[[Omis.Core.Domain.TCustomerModuls, Omis.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]])values[1];
t.TVisMaskList = (System.Collections.Generic.IList`1[[Omis.Core.Domain.TVisMask, Omis.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]])values[2];
}
catch( InvalidCastException ice )
{
throw new MappingException(
"Invalid mapping information specified for type " + obj.GetType() + ", check your mapping file for property type mismatches",
ice);
}
}
public object[] GetPropertyValues(object obj) {
Omis.Core.Domain.TModules t = (Omis.Core.Domain.TModules)obj;
object[] ret = new object[3];
ret[0] = t.Description;
ret[1] = t.TCustomerModulsList;
ret[2] = t.TVisMaskList;
return ret;
}
}
}

13:27:10.156 [3060] DEBUG NHibernate.Persister.GetSetHelperFactory - Line:16, Column:60 Message:Unerwartetes Zeichen `.
13:27:10.156 [3060] DEBUG NHibernate.Persister.GetSetHelperFactory - Line:17, Column:53 Message:Unerwartetes Zeichen `.
13:27:10.156 [3060] INFO NHibernate.Persister.GetSetHelperFactory - Disabling reflection optimizer for class Omis.Core.Domain.TModules
13:27:10.156 [3060] DEBUG NHibernate.Persister.GetSetHelperFactory - CodeDOM compilation failed

I don't know where this unexpected Character comes from. It would be nice if anybody could help me to find a solution.

Thanks in advance


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 10, 2007 10:20 pm 
Beginner
Beginner

Joined: Mon Jan 08, 2007 11:59 pm
Posts: 31
I do not understand why it is not using LCG as the default bytecode provider.

Can you try using
Code:
<property name="bytecode.provider">lcg</property>
in your NH configuration file and try again. This will tell NH to not use CodeDom as the bytecode provider instead use LCG, see if this helps.

Regards
Job Samuel


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 11, 2007 7:01 am 
Newbie

Joined: Wed Jan 10, 2007 10:25 am
Posts: 3
Thanks for your answer:
I did the following:
NHibernate.Cfg.Configuration cfg = new NHibernate.Cfg.Configuration();
cfg.SetProperty("bytecode.provider", "lcg");

but nothing happend.

Which config file do you mean -> app.config, web.config

Sorry I'm really a newbie so i have to ask this

Best regards


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 11, 2007 7:07 am 
Regular
Regular

Joined: Tue Aug 08, 2006 4:28 am
Posts: 96
Location: Hong Kong
As far as I know, NHibernate 1.0.3 does not support the use of Generics in .net 2.0. Please try NHibernate 1.2.0 Beta3.

Regards,

Ken


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 11, 2007 9:06 am 
Newbie

Joined: Wed Jan 10, 2007 10:25 am
Posts: 3
Thanks a lot for your help, the version update was the solution


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