I am getting very frustrated and I am unfortunately at the point that
my productivity is getting hurt so bad I am about to pull NHibernate
out of my code and just go back to doing everything manually.  I know
none of that is relevant to any of you but I have to vent a bit.  Here
are my issues and how I arrived at where I am now.

First I was having an issue with some unit tests not working.  I was
updating a row in a table and then checking to make sure that row was
updated properly.  I looked at the database and it was updated
properly but the get function did not return the modified row rather
it returned the original version of the row thus causing my unit test
to fail.  Yet if I run the test by itself it worked.

I tried posting on here but did not get a response so I continued
trying to work the issue out myself.  Well somewhere along the lines I
encapsulated my session provider in a singleton and now I have a
persistent session for my data provider class.  Well this, even though
that was the sample given in the manual, has now reaked(sp?) total
havoc on my unit tests.  They started almost all failing.  I had to,
which is better anyways, wrap all of my try catches in a while loop
that allowed the code to try three times and if at anytime it failes
it goes back to the session provider and resets the session and gives
me a new one.  Well this is happening way too much in my opinion.

I now also am getting extremely vague errors that I have absolutely no
clue on how to debug.  For instance I have a Delete unit tests that
actualy creates a row in the DB, I assert that it has been created and
that is successful, then I remove that row from the DB but I get this
error:

NHibernate.StaleStateException: Unexpected row count: 0; expected: 1.
This happens even if I run the unit test by itself.  It is running a
delete query repeatedly when I look at the sql output:

NHibernate: SELECT user0_.UserID as UserID10_0_, user0_.FirstName as
FirstName10_0_, user0_.LastName as LastName10_0_, user0_.UserName as
UserName10_0_, user0_.Password as Password10_0_, user0_.EmailAddress
as EmailAdd6_10_0_, user0_.AccessLevelID as AccessLe7_10_0_,
user0_.RequirePasswordChange as RequireP8_10_0_, user0_.UserAdded as
UserAdded10_0_, user0_.DateAdded as DateAdded10_0_, user0_.UserEdited
as UserEdited10_0_, user0_.DateEdited as DateEdited10_0_ FROM
dbo.tblUsers user0_ WHERE user0_.user...@p0; @p0 = '1'
NHibernate: INSERT INTO dbo.tblCWTRatingGroups (Name, UserAdded,
DateAdded, UserEdited) VALUES (@p0, @p1, @p2, @p3); select
SCOPE_IDENTITY(); @p0 = '865962ff-13eb-4aca-acfb-937f8cd095df', @p1 =
'1', @p2 = '4/13/2009 9:38:01 AM', @p3 = ''
NHibernate: DELETE FROM dbo.tblCWTRatingGroups WHERE Id = @p0; @p0 =
'15'
NHibernate: DELETE FROM dbo.tblCWTRatingGroups_RatingRules WHERE
GroupId = @p0; @p0 = '15'
NHibernate: DELETE FROM dbo.tblCWTRatingGroups WHERE Id = @p0; @p0 =
'15'
NHibernate: DELETE FROM dbo.tblCWTRatingGroups_RatingRules WHERE
GroupId = @p0; @p0 = '15'
NHibernate: DELETE FROM dbo.tblCWTRatingGroups WHERE Id = @p0; @p0 =
'15'
NHibernate: DELETE FROM dbo.tblCWTRatingGroups_RatingRules WHERE
GroupId = @p0; @p0 = '15'
NHibernate: DELETE FROM dbo.tblCWTRatingGroups WHERE Id = @p0; @p0 =
'15'


It should not be running all of those deletes.  There are actualy no
rating rules attached to this group or to any group at this point.
Even if there were it cascades in the DB so only the rating group
needs to be removed and the rest will be taken care of on the DB end.

I also have issues with another delete unit test in which I create a
row in the DB just as before and it is successful, then I try to
remove it and it says I attempted to delete using a null entity.

I didn't have any of these issues before I went to a singleton class
but I had the other issues.  It truly seems I am damned if I do and
damned if I don't.

I am sorry to make this post so long and be so irritable but I am
going to have to start answering for why this is taking me so much
time and I can't even explain it myself.  I know there is a learning
curve but this is a bit ridiculous as I don't consider myself an
idiot, but I may have to reevaluate it seems.

Thanks in advance,
Josh Rogers


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to