-->
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: System.InvalidCharacter exception in code dom
PostPosted: Wed Apr 19, 2006 7:00 pm 
Newbie

Joined: Thu Feb 02, 2006 2:01 pm
Posts: 3
Hi ,
I am running a test of my code and am receiving a System.InvalidCharacter exception from the CodeDom.

Below is a portion of the mapping file and the resultant code.
The line from the mapping to take notice of is

<property name="AddressId" column="addressId" type="Guid" />
<many-to-one name="Address" column="addressId" class="Intuit.SBM.Platform.AddressData, Intuit.SBM.Platform" update="false" insert="false" />


which results in
t.AddressId = values[10] == null ? new System.Nullable`1[[System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]() : (System.Nullable`1[[System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]])values[10];

I don't understand where the `1 is coming from.

Has anyone seen this before?

Thanks

Bruce

Hibernate version1.02:

[b]Mapping documents:
<class name="Intuit.SBM.Platform.ContactData" table="Contact" dynamic-update="true" dynamic-insert="true">
<id name="Id" type="Guid" column="contactId" >
<generator class="assigned" />
</id>
<property name="CreatedDateTime" column="createdDateTime" type="DateTime" />
<property name="ModifiedDateTime" column="modifiedDateTime" type="DateTime" />

<property name="AddressId" column="addressId" type="Guid" />
<many-to-one name="Address" column="addressId" class="Intuit.SBM.Platform.AddressData, Intuit.SBM.Platform" update="false" insert="false" />

<property name="TelephoneNumber1" column="telephoneNumber1" type="String" />
<property name="TelephoneNumber2" column="telephoneNumber2" type="String" />
<property name="CellularNumber" column="cellularNumber" type="String" />

<property name="EMail" column="email" type="String" />
<property name="EMailCarbonCopy" column="emailCarbonCopy" type="String" />
<property name="FaxNumber" column="faxNumber" type="String" />
<property name="PagerNumber" column="pagerNumber" type="String" />
<property name="PagerPin" column="pagerPin" type="String" />

<property name="Contact1" column="contact1" type="String" />
<property name="Contact2" column="contact2" type="String" />
<property name="Note" column="note" type="String" />
<property name="ExpiredDate" column="expiredDate" type="DateTime" />
</class>


Code:
using System;
using NHibernate.Property;
namespace NHibernate.Persister {
public class GetSetHelper_Intuit_SBM_Platform_ContactData : IGetSetHelper {
ISetter[] setters;
IGetter[] getters;
public GetSetHelper_Intuit_SBM_Platform_ContactData(ISetter[] setters, IGetter[] getters) {
this.setters = setters;
this.getters = getters;
}
public void SetPropertyValues(object obj, object[] values) {
Intuit.SBM.Platform.ContactData t = (Intuit.SBM.Platform.ContactData)obj;
try
{
t.TelephoneNumber2 = (System.String)values[0];
t.CellularNumber = (System.String)values[1];
t.Note = (System.String)values[2];
t.EMailCarbonCopy = (System.String)values[3];
t.Contact2 = (System.String)values[4];
t.Contact1 = (System.String)values[5];
t.PagerPin = (System.String)values[6];
t.CreatedDateTime = values[7] == null ? new System.DateTime() : (System.DateTime)values[7];
t.PagerNumber = (System.String)values[8];
t.Address = (Intuit.SBM.Platform.AddressData)values[9];
t.AddressId = values[10] == null ? new System.Nullable`1[[System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]() : (System.Nullable`1[[System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]])values[10];
t.ModifiedDateTime = values[11] == null ? new System.DateTime() : (System.DateTime)values[11];
t.TelephoneNumber1 = (System.String)values[12];
t.ExpiredDate = values[13] == null ? new System.Nullable`1[[System.DateTime, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]() : (System.Nullable`1[[System.DateTime, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]])values[13];
t.FaxNumber = (System.String)values[14];
t.EMail = (System.String)values[15];
}
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) {
Intuit.SBM.Platform.ContactData t = (Intuit.SBM.Platform.ContactData)obj;
object[] ret = new object[16];
ret[0] = t.TelephoneNumber2;
ret[1] = t.CellularNumber;
ret[2] = t.Note;
ret[3] = t.EMailCarbonCopy;
ret[4] = t.Contact2;
ret[5] = t.Contact1;
ret[6] = t.PagerPin;
ret[7] = t.CreatedDateTime;
ret[8] = t.PagerNumber;
ret[9] = t.Address;
ret[10] = t.AddressId;
ret[11] = t.ModifiedDateTime;
ret[12] = t.TelephoneNumber1;
ret[13] = t.ExpiredDate;
ret[14] = t.FaxNumber;
ret[15] = t.EMail;
return ret;
}
}
}


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 20, 2006 8:04 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
This is a known bug. It should not cause any ill effects because the exception is caught later in the code and the codedom optimizer is disabled for the problem class.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 20, 2006 4:05 pm 
Newbie

Joined: Thu Feb 02, 2006 2:01 pm
Posts: 3
Thanks for the info

So I assume it is a performance hit ?

Bruce


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 20, 2006 4:23 pm 
Beginner
Beginner

Joined: Tue May 17, 2005 7:25 pm
Posts: 43
Location: Somewhere, USA
You could try this version of the reflection optimizer instead.

http://forum.hibernate.org/viewtopic.php?t=956966


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.