Max,
Thank for reply. Sorry, I highlighted the wrong line.
Please see below properites between NH 1.2 and 2.1, there are two
different connection strings in cfg.properties,
["hibernate.connection.connection_string"]
and ["connection.connection_string"]. One show absolute path and other one
shows relative path. Where as in 2.1 and 3.3.1, there is only one
connection string ["connection.connection_string"].
hibernate.connection.connection_string
got removed from the properites in 2.1 or later versions.
config.Properties = UpdateCfgProperty(profilePath, config.Properties);
This line of code doesn't throw an exception with NH 1.2 and 2.1 or later
version generates an exception when input file (mdb) doesn't exist in file
open directory.
this._nhibernateFactory =
this._nhibernateConfiguration.BuildSessionFactory();
NH 1.2
---------------
["hibernate.session_factory_name"] "nhibernator"
["hibernate.connection.driver_class"] "NHibernate.JetDriver.JetDriver,
NHibernate.JetDriver"
["hibernate.use_reflection_optimizer"] "true"
["show_sql"] "true"
["hibernate.connection.connection_string"]
"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\\Exports\\mydb.mdb"
["connection.driver_class"] "NHibernate.JetDriver.JetDriver,
NHibernate.JetDriver"
["hibernate.cache.use_second_level_cache"] "false"
["hibernate.query.substitutions"] "true 1, false 0, yes 'Y', no 'N'"
["connection.connection_string"] "\r\n
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=.\\mydb.mdb"
["hibernate.show_sql"] "true"
["query.substitutions"] "true 1, false 0, yes 'Y', no 'N'"
["use_outer_join"] "false"
["hibernate.use_outer_join"] "false"
["dialect"] "NHibernate.JetDriver.JetDialect, NHibernate.JetDriver"
["hibernate.connection.provider"]
"NHibernate.Connection.DriverConnectionProvider"
["hibernate.dialect"] "NHibernate.JetDriver.JetDialect,
NHibernate.JetDriver"
["connection.provider"] "NHibernate.Connection.DriverConnectionProvider"
NH 2.1
-----------
[use_reflection_optimizer,
True]}
System.Collections.Generic.KeyValuePair<string,string>
[session_factory_name,
nhibernator]}
System.Collections.Generic.KeyValuePair<string,string>
[connection.provider,
NHibernate.Connection.DriverConnectionProvider]}
System.Collections.Generic.KeyValuePair<string,string>
[connection.driver_class, NHibernate.JetDriver.JetDriver,
NHibernate.JetDriver]} System.Collections.Generic.KeyValuePair<string,string>
[dialect, NHibernate.JetDriver.JetDialect,
NHibernate.JetDriver]}
System.Collections.Generic.KeyValuePair<string,string>
[connection.connection_string, Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\Users\gundas1\Desktop\VS.Net\CADeTWin_3\Exports\mydb.mdb]}
System.Collections.Generic.KeyValuePair<string,string>
[show_sql,
true]}
System.Collections.Generic.KeyValuePair<string,string>
[use_outer_join,
false]}
System.Collections.Generic.KeyValuePair<string,string>
[query.substitutions, true 1, false 0, yes 'Y', no
'N']}
System.Collections.Generic.KeyValuePair<string,string>
[cache.use_second_level_cache,
false]}
System.Collections.Generic.KeyValuePair<string,string>
[proxyfactory.factory_class,
NHibernate.ByteCode.Castle.ProxyFactoryFactory,
NHibernate.ByteCode.Castle]}
System.Collections.Generic.KeyValuePair<string,string>
Thank you,
Rdi
On Sunday, August 12, 2012 9:15:22 AM UTC-5, Maximilian Haru Raditya wrote:
> > Some reason NH 2.1 doesn't like
> "hibernate.cache.use_second_level_cache", but it takes without hibernate
> infront, i.e., cache.use_second_level_cache
>
> That's right. Just remove "hibernate" prefix when using newer NH versions.
>
>
> > NH 1.2 shows two connection string properties, but NH 2.1 deosn't. Also,
> I noticed lot difference in properties. Please refer below for the diff bet
> 1.2 vs 2.1 properites. Now, I understand, why NH 2.1 fails to open another
> mdb input file.
>
> What do you mean by two "connection string" properties?
> "connection.connection_string" and "connection.provider" are different.
>
>
> > Is there a way to enable two connection string properties? How should I
> handld in this case?
>
> I think the easiest way would be creating two different session factories
> with different names. It would mean to create two separate session factory
> configuration, with each pointing to a different database, or in this case
> separate .MDB files.
>
>
>
>
>
> On Sun, Aug 12, 2012 at 6:12 AM, Rdi <[email protected] <javascript:>>wrote:
>
>> Max,
>>
>> Thank you very much for reply.
>>
>> <property name="hibernate.cache.use_second_level_cache">false</property>
>>
>> Some reason NH 2.1 doesn't like "hibernate.cache.use_second_level_cache",
>> but it takes without hibernate infront, i.e., cache.use_second_level_cache
>>
>> NH 1.2 shows two connection string properties, but NH 2.1 deosn't. Also,
>> I noticed lot difference in properties. Please refer below for the diff bet
>> 1.2 vs 2.1 properites. Now, I understand, why NH 2.1 fails to open another
>> mdb input file.
>>
>> ["hibernate.connection.connection_string"]
>> ["hibernate.connection.provider"]
>>
>>
>> NH 1.2
>> ---------------
>> ["hibernate.session_factory_name"] "nhibernator"
>> ["hibernate.connection.driver_class"] "NHibernate.JetDriver.JetDriver,
>> NHibernate.JetDriver"
>> ["hibernate.use_reflection_optimizer"] "true"
>> ["show_sql"] "true"
>> ["hibernate.connection.connection_string"]
>> "Provider=Microsoft.Jet.OLEDB.4.0;Data
>> Source=C:\\Projects\\MSD Projects\\CADeTWin\\CADeTWin_3\\Exports\\mydb.mdb"
>> ["connection.driver_class"] "NHibernate.JetDriver.JetDriver,
>> NHibernate.JetDriver"
>> ["hibernate.cache.use_second_level_cache"] "false"
>> ["hibernate.query.substitutions"] "true 1, false 0, yes 'Y', no 'N'"
>> ["connection.connection_string"] "\r\n
>> Provider=Microsoft.Jet.OLEDB.4.0;Data Source=.\\mydb.mdb"
>> ["hibernate.show_sql"] "true"
>> ["query.substitutions"] "true 1, false 0, yes 'Y', no 'N'"
>> ["use_outer_join"] "false"
>> ["hibernate.use_outer_join"] "false"
>> ["dialect"] "NHibernate.JetDriver.JetDialect, NHibernate.JetDriver"
>>
>> ["hibernate.connection.provider"]
>> "NHibernate.Connection.DriverConnectionProvider"
>> ["hibernate.dialect"] "NHibernate.JetDriver.JetDialect,
>> NHibernate.JetDriver"
>> ["connection.provider"] "NHibernate.Connection.DriverConnectionProvider"
>>
>> NH 2.1
>> -----------
>> [use_reflection_optimizer,
>> True]}
>> System.Collections.Generic.KeyValuePair<string,string>
>> [session_factory_name,
>> nhibernator]}
>> System.Collections.Generic.KeyValuePair<string,string>
>> [connection.provider,
>> NHibernate.Connection.DriverConnectionProvider]}
>> System.Collections.Generic.KeyValuePair<string,string>
>> [connection.driver_class, NHibernate.JetDriver.JetDriver,
>> NHibernate.JetDriver]} System.Collections.Generic.KeyValuePair<string,string>
>> [dialect, NHibernate.JetDriver.JetDialect,
>> NHibernate.JetDriver]}
>> System.Collections.Generic.KeyValuePair<string,string>
>> [connection.connection_string, Provider=Microsoft.Jet.OLEDB.4.0;Data
>> Source=C:\Users\gundas1\Desktop\VS.Net\CADeTWin_3\Exports\mydb.mdb]}
>> System.Collections.Generic.KeyValuePair<string,string>
>> [show_sql,
>> true]}
>> System.Collections.Generic.KeyValuePair<string,string>
>> [use_outer_join,
>> false]}
>> System.Collections.Generic.KeyValuePair<string,string>
>> [query.substitutions, true 1, false 0, yes 'Y', no
>> 'N']}
>> System.Collections.Generic.KeyValuePair<string,string>
>> [cache.use_second_level_cache,
>> false]}
>> System.Collections.Generic.KeyValuePair<string,string>
>> [proxyfactory.factory_class,
>> NHibernate.ByteCode.Castle.ProxyFactoryFactory,
>> NHibernate.ByteCode.Castle]}
>> System.Collections.Generic.KeyValuePair<string,string>
>>
>>
>> Is there a way to enable two connection string properties? How should I
>> handld in this case?
>>
>> Any suggestions are appreciated. Thank you for your time in helping me.
>>
>>
>> Thank you,
>> Rdi
>>
>>
>>
>> On Saturday, August 11, 2012 4:37:38 PM UTC-5, Maximilian Haru Raditya
>> wrote:
>>
>>> You call me Max... :D
>>>
>>>
>>> > *What are the dlls that goes along with the Jet drivers that you
>>> provided for NH 3.3.1. Do I have a Castle Dynamic Proxy dll for NH 3.3 or
>>> just use Caste Core dlls only. *
>>>
>>> You only need two assemblies: *Iesi.Collections.dll *and *NHibernate.dll
>>> *3.3.1 GA (versioned as 3.3.1.4000).
>>> You don't need *Antlr.Runtime.dll *as it's been internalized in
>>> NHibernate assembly.
>>> You don't need *Castle.Core.dll*/*Castle.DynamicProxy*.dll *as well as
>>> NHibernate already uses its own proxy factory.
>>>
>>> About your issue after upgrading to 2.1, sorry I can't help you. I'm not
>>> really familiar with these MS Jet DB stuffs, but when I ran the tests suite
>>> from the source, they all passed, so I think there should be no problem.
>>> After you upgrade to 3.3.1, I think you can see whether the issue still
>>> exists. Just look at what the exception thrown is.
>>>
>>> You're welcome.
>>>
>>>
>>>
>>>
>>> On Sun, Aug 12, 2012 at 2:17 AM, Rdi <[email protected]> wrote:
>>>
>>>> Maximilian Haru Raditya
>>>> Thank you very much for your reply.
>>>>
>>>> I'm trying to convert my project NH 1.2 to 2.1. I endup adding
>>>> additional dlls to run project fine and those weren't used in NH 1.2. I
>>>> don't why antlr runtime needs to be used for NH 2.1 either.
>>>>
>>>> NHibernate dll - 2.1.0.4000
>>>> NHibernate.ByteCode.Castle dll 2.1.0.4000 - new in 2.1
>>>> Iesi.Collections dll 2.1.0.4000
>>>> Castle.DynamicProxy2 dll 2.1.0.0 - new in 2.1
>>>>
>>>> Castle.DynamicProxy dll 1.1.5.0
>>>> Castle.Core dll 2.5.0.
>>>> Antlr3.Runtime **** 3.1.0 - new in 2.1
>>>>
>>>> *What are the dlls that goes along with the Jet drivers that you
>>>> provided for NH 3.3.1. Do I have a Castle Dynamic Proxy dll for NH 3.3 or
>>>> just use Caste Core dlls only. *
>>>>
>>>>
>>>>
>>>> *I have another issue after upgrading to NH 2.1 and I described in
>>>> previous post. *
>>>>
>>>> *Issue after upgrading to 2.1:*
>>>> Software uses MS Access mdf files as input files and store all the data
>>>> in different tables. Once after I converted the project and try to open an
>>>> mdb file other than defult file linked in Data Source, software fails to
>>>> switch profile to open different mdb file until I place default source
>>>> file
>>>> specified in data source to open file directory. It use to work fine in
>>>> the
>>>> previous version NH 1.x.
>>>>
>>>> <property name="connection.connection_**st**ring">
>>>> Provider=Microsoft.Jet.OLEDB.**4**.0;Data
>>>> Source=.\mydb.mdb</property>
>>>> software failing at below line with the error, can not find mydb.mdb
>>>> file.
>>>> this._nhibernateFactory = this._nhibernateConfiguration.****
>>>> BuildSessionFactory();
>>>>
>>>> *my code looks like below:*
>>>> public bool InitDatabase(String strDatabasePath)
>>>> {
>>>> if (!File.Exists(strDatabasePath)****)
>>>> {
>>>> MessageBox.Show("File: " + strDatabasePath + " does
>>>> not exist");
>>>> return false;
>>>> }
>>>> try
>>>> {
>>>> SessionFactory sf = SessionFactory.GetInstance();
>>>> if (!SessionFactory.**SwitchProfile**(strDatabasePath)*
>>>> *)
>>>> {
>>>> MessageBox.Show("Error opening File: " +
>>>> strDatabasePath);
>>>> return false;
>>>> }
>>>> }
>>>> return true;
>>>> }
>>>>
>>>>
>>>> SessionFactory.GetInstance();**** make call to SessionFactory
>>>>
>>>> private SessionFactory()
>>>> {
>>>> log4net.Config.**XmlConfigurator**.Configure();
>>>> RegisterCoreClasses(null);
>>>> }
>>>>
>>>> private void RegisterCoreClasses(string profilePath)
>>>> {
>>>> try
>>>> {
>>>> Configuration config = new Configuration();
>>>> this._nhibernateConfiguration = config.Configure();
>>>> //read NHibernate settings from hibernate.cfg.xml
>>>> config.Properties = UpdateCfgProperty(profilePath,
>>>> config.Properties);
>>>> this._nhibernateFactory = this._nhibernateConfiguration.
>>>> ****BuildSessionFactory(); //getting error at this line can't find
>>>> file mydb.mdb. If this default file exists in file open directory,
>>>> software
>>>> switches to opened file with no issues.
>>>> CloseSession();
>>>> }
>>>> }
>>>>
>>>>
>>>> Appreciate your help. Thanks.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On Saturday, August 11, 2012 7:46:18 AM UTC-5, Maximilian Haru Raditya
>>>> wrote:
>>>>
>>>>> It's the one from NHContrib, right? If so, grab it here:
>>>>> https://www.dropbox.com/sh/**5qr**if8kr6s75bkt/yQC0h8kMCP<https://www.dropbox.com/sh/5qrif8kr6s75bkt/yQC0h8kMCP>
>>>>> It's compiled against NH 3.3.1 GA (on x86 platform, instead of AnyCPU
>>>>> one).
>>>>>
>>>>> Though I only test it using the its internal tests suite, I think it
>>>>> should work just fine. If it didn't, then you might have to build it
>>>>> yourself from the source.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Sat, Aug 11, 2012 at 11:18 AM, Rdi <[email protected]> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> Thank for your reply and hlep.
>>>>>>
>>>>>> I couldn't find NHibernate Jet drivers for NH 3.3. The latest Jet
>>>>>> driver that I found on Richard's blog is compiled for NH 2.1. If there
>>>>>> is a
>>>>>> latest Jet driver for NH 3.3, please point me to web link or downloads.
>>>>>>
>>>>>> http://coderead.wordpress.com/******2010/10/20/nhibernate-jet-**driv*
>>>>>> ***er/<http://coderead.wordpress.com/2010/10/20/nhibernate-jet-driver/>
>>>>>>
>>>>>> Thank you,
>>>>>> Rdi
>>>>>>
>>>>>>
>>>>>> On Friday, August 10, 2012 5:27:19 PM UTC-5, SexualChocolate wrote:
>>>>>>
>>>>>>> Just curious, but is there a reason you're choosing to only
>>>>>>> upgrade to the 2.x version? The latest is 3.3, I believe, and a number
>>>>>>> of
>>>>>>> your questions are not applicable for the 3.x versions.
>>>>>>>
>>>>>>> On Aug 10, 2012 6:19 PM, "Rdi" <[email protected]> wrote:
>>>>>>> >
>>>>>>> > I'm trying to convert my project from vs.net 2005 to 2010. My
>>>>>>> project uses NHibernate 1.x dll and it has been running fine 2005
>>>>>>> compiled
>>>>>>> version. However, when I convert to 2010, HQL failed to return internal
>>>>>>> subclass / mapping class object values. I googled around on the web and
>>>>>>> found 2.x Nhibernate dlls.
>>>>>>> >
>>>>>>> > Currently, my project is referenced to below dlls.
>>>>>>> > NHibernate Jet driver dll 1.2.0.4000
>>>>>>> > Castle.DynamicProxy dll 1.1.5.0
>>>>>>> > Iesi.Collections dll 1.2.0.4000
>>>>>>> > log4net dll 1.2.10.0
>>>>>>> > I replaced my project dlls with below dlls along with some
>>>>>>> additional dlls. Because I didn't any article on how to upgrade from
>>>>>>> NHibaernate 1.x to some NHibernate x version. I try to play around with
>>>>>>> the
>>>>>>> info that I found on the web.
>>>>>>> >
>>>>>>> > NHibernate Jet driver dll:
>>>>>>> > http://coderead.wordpress.com/******2010/10/20/nhibernate-jet-**
>>>>>>> driv****er/<http://coderead.wordpress.com/2010/10/20/nhibernate-jet-driver/>
>>>>>>> >
>>>>>>> > NHibernate dll - 2.1.0.4000
>>>>>>> > NHibernate.ByteCode.Castle dll 2.1.0.4000
>>>>>>> > Iesi.Collections dll 2.1.0.4000
>>>>>>> > Castle.DynamicProxy2 dll 2.1.0.0
>>>>>>> > Castle.DynamicProxy dll 1.1.5.0
>>>>>>> > Castle.Core dll 2.5.0.
>>>>>>> > Antlr3.Runtime ****** 3.1.0
>>>>>>> >
>>>>>>> > Once after adding reference to above dlls and compiled okay with
>>>>>>> little changes in the code. However, I have an issues when switch
>>>>>>> database
>>>>>>> profile, also some of the objects retuning null. I'm wondering, whether
>>>>>>> the
>>>>>>> upgrade has done is correct or not. Because I have to add additional
>>>>>>> dlls
>>>>>>> like antlr runtime, dynmic proxy2, and castle core etc.
>>>>>>> >
>>>>>>> > I know for sure, lot of them been through this process and they
>>>>>>> are NHibernate expers in this forum. I appreciate if anybody direct me
>>>>>>> to
>>>>>>> right path.
>>>>>>> >
>>>>>>> >
>>>>>>> > Thanks.
>>>>>>> >
>>>>>>> > --
>>>>>>> > You received this message because you are subscribed to the Google
>>>>>>> Groups "nhusers" group.
>>>>>>> > To view this discussion on the web visit
>>>>>>> https://groups.google.com/d/**ms****g/nhusers/-/9TC7bSQpEbEJ<https://groups.google.com/d/msg/nhusers/-/9TC7bSQpEbEJ>
>>>>>>> .
>>>>>>> > To post to this group, send email to [email protected].
>>>>>>> > To unsubscribe from this group, send email to nhusers+u...@**
>>>>>>> googlegroups.com.
>>>>>>>
>>>>>>> > For more options, visit this group at http://groups.google.com/**
>>>>>>> group****/nhusers?hl=en<http://groups.google.com/group/nhusers?hl=en>
>>>>>>> .
>>>>>>>
>>>>>>> --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "nhusers" group.
>>>>>> To view this discussion on the web visit https://groups.google.com/d/
>>>>>> **ms**g/nhusers/-/9B27Y_wvRR8J<https://groups.google.com/d/msg/nhusers/-/9B27Y_wvRR8J>.
>>>>>>
>>>>>>
>>>>>>
>>>>>> To post to this group, send email to [email protected].
>>>>>> To unsubscribe from this group, send email to nhusers+u...@**
>>>>>> googlegroups.com.
>>>>>> For more options, visit this group at http://groups.google.com/**
>>>>>> group**/nhusers?hl=en <http://groups.google.com/group/nhusers?hl=en>.
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Regards,
>>>>>
>>>>> Maximilian Haru Raditya
>>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "nhusers" group.
>>>> To view this discussion on the web visit https://groups.google.com/d/**
>>>> msg/nhusers/-/DEqxogdEV34J<https://groups.google.com/d/msg/nhusers/-/DEqxogdEV34J>.
>>>>
>>>>
>>>>
>>>> To post to this group, send email to [email protected].
>>>> To unsubscribe from this group, send email to nhusers+u...@**
>>>> googlegroups.com.
>>>> For more options, visit this group at http://groups.google.com/**
>>>> group/nhusers?hl=en <http://groups.google.com/group/nhusers?hl=en>.
>>>>
>>>
>>>
>>>
>>> --
>>> Regards,
>>>
>>> Maximilian Haru Raditya
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "nhusers" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/nhusers/-/xXzT9z6zc0wJ.
>>
>> To post to this group, send email to [email protected]<javascript:>
>> .
>> To unsubscribe from this group, send email to
>> [email protected] <javascript:>.
>> For more options, visit this group at
>> http://groups.google.com/group/nhusers?hl=en.
>>
>
>
>
> --
> Regards,
>
> Maximilian Haru Raditya
>
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/nhusers/-/HP0M3qfaJ3sJ.
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.