-->
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.  [ 2 posts ] 
Author Message
 Post subject: [solved] Version Switch:1.2.0 to 1.2.1-Problem with .List()
PostPosted: Sun Jan 13, 2008 7:07 am 
Newbie

Joined: Sun Jan 13, 2008 6:48 am
Posts: 16
Hello Hibernators,

i have a small problem which i can't solve on my own.

I have the following scenario:
i have an ASP.NET application, which runned on hibernate 1.2.0 very nice. Everything worked absolute correctly.
Since the version i used was in RC-status (if i recommend correctly), i decided to upgrade to version 1.2.1, which is stable since i'm interested in deploying on a live webserver.

After struggling with all that namespace changes from from
Code:
urn:nhibernate-configuration-2.0

to
Code:
urn:nhibernate-configuration-2.2

i got the IDE to compile the whole thing.

The session factory and all that stuff is created as usual (in fact, i didn't change the code for building the session factory).

But when it comes to load data from DB via criterias/list, nothing works out: the results are always empty/null.

In preceding versions of hibernate, having an empty resultset was a problem of the setting for the mapping files (this needs to be "Embedded resource" in earlier versions) - but this settings are still correct, i didn't change them.

Here is my hibernate configuration from within web.config file:
Code:
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
  <session-factory name="TestDBAssembly">
    <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
    <property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
    <property name="connection.connection_string">Server=localhost;initial catalog=TestDB_main;uid=TestDB_user;pwd=test07</property>
    <property name="dialect">NHibernate.Dialect.MsSql2005Dialect</property>
    <property name="connection.isolation">ReadCommitted</property>
    <property name="default_schema">TestDB_main.dbo</property>
  </session-factory>
</hibernate-configuration>


Here is an example of one of my mapping files (all mapping files looking similar in the header section).
Code:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
  <class name="TestDBAssembly.T_Locales, TestDBAssembly" table="T_Locales">

    <id name="ID" type="int" length="4">
      <generator class="identity" />
    </id>

    <property name="Name" type="string" />
    <property name="LanguageName" type="string" />
    <property name="LanguageFullName" type="string" />
    <property name="LanguageMnemonic" type="string" />
    <property name="CountryName" type="string" />

  </class>
</hibernate-mapping>


i'm working with SQL2005 with SP1, VS.NET2005, ASP.NET 2.0 on Windows XP SP2.

I have looked at the migration guide, but all the issues mentioned there (except the namespace changing) are not relevant for my application, since it consists just of gets/sets.
I tried also to check, if NHibernates execute a query, by looking into SQL Profiler - but it seems that NHibernate doesn't start a query at all.

Has anyone andy idea what the problem could be?

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 13, 2008 4:07 pm 
Newbie

Joined: Sun Jan 13, 2008 6:48 am
Posts: 16
hi,

it was a misstake in my code.

as told, i adapted the code and it seems i stumbled over that specific part in the source:
instead of having a single/simple line like
Code:
sessionFactory = new Configuration().Configure().BuildSessionFactory();

i had the following construction:
Code:
nhConfig = new NHibernate.Cfg.Configuration();
nhConfig.Configure();
sessionFactory = nhConfig.Configure().BuildSessionFactory();

i'm honest: i don't know why it worked with NHibernate 1.2.0 and why it didn't work with version 1.2.1 - i have used the latter for over 8 month now...

finally, it works now :)

thanks, though...


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