-->
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.  [ 8 posts ] 
Author Message
 Post subject: NHibernate + Mono + SqlLite + Linux
PostPosted: Wed May 31, 2006 4:55 pm 
Newbie

Joined: Thu May 25, 2006 4:22 pm
Posts: 9
Hello !
I'm new to NHibernate anf I would like to learn ... So I'm reading the doc and I download the step-by-step exemple ...

But as I'm a not a Windows/SqlServer user I'm trying to make it work on Linux/Mono/Sqlite ... I'm fighting against small problems ... I've tried to read docs but now ...

Point 1 : Mono does not include Sqlite.Net but Mono.Data.SqliteClient ...
So after a small reading, I've seen that I've have to change the present Driver to make it point to Mono.Data.SqliteClient instead of Sqlite.Net ...

==> object not set to an instance of an object

Point 2 : Compile NHibernate with MonoDevelop

In fact, the problem is the that the ressource name is NHibernate.<RessourceName>. Compiling with MonoDevelop, the ressource Name is <RessouceName>. In order to make it work, I've put a test to check both ... First Ok, is used ...

Point 3 : Parameters ...

It seems that @ is not recognize by my Sqllite or Mono.Data.SqliteClient but : works better ...

Point 4 : A new object not set to an instance of an object ...
see the trace :-)


If somebody can help me !!!


Hibernate version: 1.1

Full stack trace of any exception that occurs:
Unhandled Exception: NHibernate.LazyInitializationException: Failed to lazily initialize a collection ---> NHibernate.HibernateException: Creating a proxy instance failed ---> System.NullReferenceException: Object reference not set to an instance of an object
in <0x00088> Castle.DynamicProxy.Builder.CodeBuilder.EasyType:IsAssemblySigned (System.Type baseType)
in <0x00032> Castle.DynamicProxy.Builder.CodeBuilder.EasyType:.ctor (Castle.DynamicProxy.Builder.CodeGenerators.ModuleScope modulescope, System.String name, System.Type baseType, System.Type[] interfaces, Boolean serializable)
in <0x0003e> Castle.DynamicProxy.Builder.CodeGenerators.BaseCodeGenerator:CreateTypeBuilder (System.String typeName, System.Type baseType, System.Type[] interfaces)
in <0x000e6> Castle.DynamicProxy.Builder.CodeGenerators.ClassProxyGenerator:GenerateCode (System.Type baseClass, System.Type[] interfaces)
in <0x00033> Castle.DynamicProxy.Builder.DefaultProxyBuilder:CreateClassProxy (System.Type theClass, System.Type[] interfaces)
in <0x00061> Castle.DynamicProxy.ProxyGenerator:CreateClassProxy (System.Type baseClass, System.Type[] interfaces, IInterceptor interceptor, Boolean checkAbstract, System.Object[] argumentsForConstructor)
in [0x00040] (at [HOME]/NHibernate/src/NHibernate/Proxy/CastleProxyFactory.cs:59) NHibernate.Proxy.CastleProxyFactory:GetProxy (System.Object id, ISessionImplementor session)--- End of inner exception stack trace ---

in [0x00096] (at [HOME]/NHibernate/src/NHibernate/Proxy/CastleProxyFactory.cs:72) NHibernate.Proxy.CastleProxyFactory:GetProxy (System.Object id, ISessionImplementor session)
in [0x00008] (at [HOME]/NHibernate/src/NHibernate/Persister/AbstractEntityPersister.cs:1496) NHibernate.Persister.AbstractEntityPersister:CreateProxy (System.Object id, ISessionImplementor session)
in [0x000a3] (at [HOME]/NHibernate/src/NHibernate/Impl/SessionImpl.cs:2407) NHibernate.Impl.SessionImpl:DoLoadByClass (System.Type clazz, System.Object id, Boolean checkDeleted, Boolean allowProxyCreation)
in [0x00005] (at [HOME]/NHibernate/src/NHibernate/Impl/SessionImpl.cs:2319) NHibernate.Impl.SessionImpl:InternalLoad (System.Type clazz, System.Object id)
in [0x00008] (at [HOME]/NHibernate/src/NHibernate/Type/ManyToOneType.cs:90) NHibernate.Type.ManyToOneType:ResolveIdentifier (System.Object id, ISessionImplementor session)
in [0x00016] (at [HOME]/NHibernate/src/NHibernate/Type/EntityType.cs:277) NHibernate.Type.EntityType:ResolveIdentifier (System.Object id, ISessionImplementor session, System.Object owner)
in [0x0000f] (at [HOME]/NHibernate/src/NHibernate/Type/EntityType.cs:177) NHibernate.Type.EntityType:NullSafeGet (IDataReader rs, System.String[] names, ISessionImplementor session, System.Object owner)
in [0x0000f] (at [HOME]/NHibernate/src/NHibernate/Collection/AbstractCollectionPersister.cs:397) NHibernate.Collection.AbstractCollectionPersister:ReadElement (IDataReader rs, System.Object owner, ISessionImplementor session)
in [0x00009] (at [HOME]/NHibernate/src/NHibernate/Collection/Set.cs:432) NHibernate.Collection.Set:ReadFrom (IDataReader rs, ICollectionPersister persister, System.Object owner)
in [0x0006f] (at [HOME]/NHibernate/src/NHibernate/Loader/Loader.cs:467) NHibernate.Loader.Loader:ReadCollectionElement (System.Object optionalOwner, System.Object optionalKey, IDataReader rs, ISessionImplementor session)
in [0x00150] (at [HOME]/NHibernate/src/NHibernate/Loader/Loader.cs:282) NHibernate.Loader.Loader:GetRowFromResultSet (IDataReader resultSet, ISessionImplementor session, NHibernate.Engine.QueryParameters queryParameters, IList hydratedObjects, System.Object optionalObject, System.Object optionalId, NHibernate.Engine.Key[] keys, Boolean returnProxies)
in [0x000cc] (at [HOME]/NHibernate/src/NHibernate/Loader/Loader.cs:337) NHibernate.Loader.Loader:DoQuery (ISessionImplementor session, NHibernate.Engine.QueryParameters queryParameters, System.Object optionalObject, System.Object optionalId, System.Object[] optionalCollectionKeys, Boolean returnProxies)--- End of inner exception stack trace ---

in [0x0006a] (at [HOME]/NHibernate/src/NHibernate/Collection/PersistentCollection.cs:263) NHibernate.Collection.PersistentCollection:Initialize (Boolean writing)
in [0x00002] (at [HOME]/NHibernate/src/NHibernate/Collection/PersistentCollection.cs:78) NHibernate.Collection.PersistentCollection:Read ()
in [0x00001] (at [HOME]/NHibernate/src/NHibernate/Collection/Set.cs:368) NHibernate.Collection.Set:GetEnumerator ()
in [0x000ae] (at [HOME]/NHibernate_Exemple/SourceCode/OrderSystem/OrderSystem.UI/CrudSamples.cs:53) OrderSystem.UI.CrudSamples:ListSupplierProductsAndManufacturers (Int32 supplierId)
in [0x00019] (at [HOME]/NHibernate_Exemple/SourceCode/OrderSystem/OrderSystem.UI/Program.cs:25) OrderSystem.UI.Program:Main ()


Name and version of the database you are using: Sqlite 3


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 31, 2006 5:16 pm 
Newbie

Joined: Thu May 25, 2006 4:22 pm
Posts: 9
Sorry ... I forgot to put a part of the trace :

Quote:
Saving changes...
Save succeded
Loading results for supplier 2
supplier 20060531-231821 is important
Products...
product 20060531-231821



Like I said I'm trung to make work the sample exemple which I found on the web site ...


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 01, 2006 5:09 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
Please report this to DynamicProxy authors, they are to blame here :) Their JIRA is at http://support.castleproject.org/jira/. Alternatively, set all your classes and collections to lazy="false", this should allow you to progress, but performance will suffer without proxies.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 01, 2006 8:05 am 
Newbie

Joined: Thu May 25, 2006 4:22 pm
Posts: 9
Thanks !
I'm gone check this ...

I'm also wondering about the 3 first step ... am I on the good road ?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 01, 2006 8:43 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
Well, those are all hacks of course, but they will work for you.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 01, 2006 11:55 am 
Newbie

Joined: Thu May 25, 2006 4:22 pm
Posts: 9
Ok :-) !

If I'm able to do some work with It can I propose my differents modifications like :
* MonoSqliteDriver ...
* Changing name of the ressource ...


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 01, 2006 4:46 pm 
Newbie

Joined: Thu May 25, 2006 4:22 pm
Posts: 9
I've tried and by settings false things are more ok !

But now : new problem :-) !

As I can see I've a problem with parameters ... But all seems to be ok when I test in an another project ...

Here is the list of parameters :
NHibernate.BatcherImpl(208) ==> Comd 0, Text : INSERT INTO SALE (QUANTITY, FK_PRODUCT, SALE_DATE, PRICE) VALUES (:p0, :p1, :p2, :p3)
NHibernate.BatcherImpl(210) ==> Param [p0] = 1 ==> Type : Decimal
NHibernate.BatcherImpl(210) ==> Param [p1] = 43 ==> Type : Int32
NHibernate.BatcherImpl(210) ==> Param [p2] = 01/06/2006 22:46:07 ==> Type : DateTime
NHibernate.BatcherImpl(210) ==> Param [p3] = 611434729 ==> Type : Decimal

Exception
Unhandled Exception: NHibernate.ADOException: could not insert: [OrderSystem.Objects.Sale] ---> System.ApplicationException: Unkown Parameter Type
in [0x00386] (at /tmp/scratch/BUILD/mono-1.1.13.4/mcs/class/Mono.Data.SqliteClient/Mono.Data.SqliteClient/SqliteCommand.cs:263) Mono.Data.SqliteClient.SqliteCommand:BindParameters3 (IntPtr pStmt)
in [0x00093] (at /tmp/scratch/BUILD/mono-1.1.13.4/mcs/class/Mono.Data.SqliteClient/Mono.Data.SqliteClient/SqliteCommand.cs:493) Mono.Data.SqliteClient.SqliteCommand:ExecuteReader (CommandBehavior behavior, Boolean want_results, System.Int32 rows_affected)
in [0x00005] (at /tmp/scratch/BUILD/mono-1.1.13.4/mcs/class/Mono.Data.SqliteClient/Mono.Data.SqliteClient/SqliteCommand.cs:402) Mono.Data.SqliteClient.SqliteCommand:ExecuteNonQuery ()
in [0x000ce] (at /donnees/Documents/Projets/MonoDevelop/NHibernate/src/NHibernate/Impl/BatcherImpl.cs:218) NHibernate.Impl.BatcherImpl:ExecuteNonQuery (IDbCommand cmd)
in [0x000dc] (at /donnees/Documents/Projets/MonoDevelop/NHibernate/src/NHibernate/Persister/EntityPersister.cs:701) NHibernate.Persister.EntityPersister:Insert (System.Object[] fields, System.Boolean[] notNull, NHibernate.SqlCommand.SqlString sql, System.Object obj, ISessionImplementor session)--- End of inner exception stack trace ---

in [0x00172] (at /donnees/Documents/Projets/MonoDevelop/NHibernate/src/NHibernate/Persister/EntityPersister.cs:731) NHibernate.Persister.EntityPersister:Insert (System.Object[] fields, System.Boolean[] notNull, NHibernate.SqlCommand.SqlString sql, System.Object obj, ISessionImplementor session)
in [0x00036] (at /donnees/Documents/Projets/MonoDevelop/NHibernate/src/NHibernate/Persister/EntityPersister.cs:584) NHibernate.Persister.EntityPersister:Insert (System.Object[] fields, System.Object obj, ISessionImplementor session)
in [0x0001f] (at /donnees/Documents/Projets/MonoDevelop/NHibernate/src/NHibernate/Impl/ScheduledIdentityInsertion.cs:48) NHibernate.Impl.ScheduledIdentityInsertion:Execute ()
in [0x00047] (at /donnees/Documents/Projets/MonoDevelop/NHibernate/src/NHibernate/Impl/SessionImpl.cs:3077) NHibernate.Impl.SessionImpl:Execute (IExecutable executable)
in [0x00161] (at /donnees/Documents/Projets/MonoDevelop/NHibernate/src/NHibernate/Impl/SessionImpl.cs:961) NHibernate.Impl.SessionImpl:DoSave (System.Object theObj, NHibernate.Engine.Key key, IClassPersister persister, Boolean replicate, Boolean useIdentityColumn, NHibernate.Engine.CascadingAction cascadeAction, System.Object anything)
in [0x000ca] (at /donnees/Documents/Projets/MonoDevelop/NHibernate/src/NHibernate/Impl/SessionImpl.cs:873) NHibernate.Impl.SessionImpl:DoSave (System.Object obj, System.Object id, IClassPersister persister, Boolean useIdentityColumn, NHibernate.Engine.CascadingAction cascadeAction, System.Object anything)
in [0x00061] (at /donnees/Documents/Projets/MonoDevelop/NHibernate/src/NHibernate/Impl/SessionImpl.cs:757) NHibernate.Impl.SessionImpl:SaveWithGeneratedIdentifier (System.Object obj, NHibernate.Engine.CascadingAction action, System.Object anything)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 05, 2006 6:10 am 
Newbie

Joined: Thu May 25, 2006 4:22 pm
Posts: 9
Hello !

Just to give you some info !

AS said here http://support.castleproject.org/jira/b ... YNPROXY-21, my problem comes from a pb of compatibility between DP and Mono. Fix seems ok but this version is not included in the last NHiber,ate.

Thanks for all info !


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