I'm figthing exceptions and some other errors from more than a week ago.
Today, at last, I achieved my goal: my first program using NHibernate and Firebird client ran into completion. I'm 'proud' to tell you that I needed to "touch" the code of both.
Even so ... the surprises are not finished ...
In brief, this first program reads data from table "A" in database "DBA" and writes some of them to a table "B" in database "DBB". The fields copied are "TSDID", "TSTAMP" and "DTA"; the Guid ( CLONE_ID ) is generated by NHibernate.
So far, so well.
Trying to learn what was exactly causing that lot of exceptions, I developed a little app, "ADO style" which near mimics the first app, but using only the Firebird NET provider ( no NHibenate in between ).
After some learnings regarding mostly "idioms", I achieved to copy some records from one table to the other.
Below is an excerpt of my table "B" data: those who have a "DTA" field starting with 2AAAFFFF, were inserted by this ultra-trial app. This app succedeed after some touch to my domain class, the "B" table, and some other hacking in the Firebird provider.
After that first success, I tried with my first app ( using NHibernate ).
The app ran until completion .. but look at my data, please
CLONE_ID TSDID TSTAMP DTA
2d72da95c92940eb9be7de29fd834edd 141 2007-12-01 00:00:07 2AAAFFFF20106405DC09A81C142AAAFFFF2200000000000000
db6eecb9497f4f2397b06dd4bf8ac2d8 141 2007-12-01 00:00:07 2AAAFFFF20106405DC09A81C142AAAFFFF2200000000000000
a6b86fe6608342cb97070ed66eae9217 141 2007-12-01 02:00:36 2AAAFFFF27000400060000404362C562C5000000006430DD09
b03784f704084af6b4022ce284dadd9e 141 2007-12-01 11:02:31 2AAAFFFF280088000000000082000040000000000000000000
067fec78fc014f46961499bc96750042 141 2007-12-01 11:02:32 System.Char[] 0
5668203701c04df498aa6919bcb6e8be 141 2007-12-01 11:02:34 System.Char[] 0
785b950272b44eada787fd5cee838513 141 2007-12-01 12:01:19 System.Char[] 0
652358a681004a8b9e01c2e1b8f29780 141 2007-12-01 12:01:21 System.Char[] 0
640661095fe94099ad05a790998b99a2 141 2007-12-01 12:01:23 System.Char[] 0
The new records inserted by this app, are those which have "System.Char[]" as the value for the DTA field !!!
I will add some other stuff
1) Metadata from my "A" class, the data source
1.1) the hbm.xml file
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="Feeder-dll" namespace="Feeder" >
<class name="Tsdreport" table="Tsdreport" dynamic-update="true" >
<id name="Tsdreportid" column="Tsdreportid" type="Int32" unsaved-value="0">
<generator class="native"></generator>
</id>
<property name="Checked1" column="CHECKED" />
<property name="Data" column="DATA" />
<property name="Datetime" />
<property name="Dbdatatime" />
<many-to-one name="Remoteterminal" column="REMOTETERMINALID" class="Remoteterminal" />
</class>
</hibernate-mapping>
Please note the mapping from "Data" property to "DTA" column ( which in turn is defined as varchar(1024) )
1.2) the relevant part of the corresponding Domain class
private string data;
private DateTime datetime;
private DateTime dbdatatime;
private Remoteterminal remoteterminal;
Note, please, that the field named "data" ( of type string ) is the source for the DTA field in
table "B"
2) Metadata from my "B" class, the sink
2.1) the hbm.xml file
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="Hidrovia-dll" namespace="Hidrovia_DB" >
<class name="Clone" table="CLONE" >
<id name="CloneId" column="CLONE_ID" type="String" unsaved-value="null">
<generator class="uuid.hex">
<param name="format">N</param>
</generator>
</id>
<property name="TsdId" column="TSDID" />
<property name="Data" column="DTA" />
<property name="Done" />
<property name="TStamp" type="DateTime" />
</class>
</hibernate-mapping>
2.2) the relevant parts of the domain class
private string cloneId; // assigned by uuid.hex, format "N"
private Int32 tsdid;
private DateTime tstamp;
private string data;
private bool done = false;
public virtual string CloneId
{
get { return cloneId; }
set { cloneId = value; }
}
public virtual int TsdId
{
get { return tsdid; }
set { tsdid = value; }
}
public virtual DateTime TStamp
{
get { return tstamp; }
set { tstamp = value; }
}
public virtual string Data
{
get { return data; }
set { data = value; }
}
public virtual bool Done
{
get { return done; }
set { done = value; }
}
The Data property and the data field reference the "DTA" field of the table ..
Can someone help ?
TIA
Marcelo
|