Hi @pkumbhar,
If you aren’t already, can you try defining a mapping class for the Student
entity type. For reference, this may be helpful.
Hi @pkumbhar,
If you aren’t already, can you try defining a mapping class for the Student
entity type. For reference, this may be helpful.
Hi @developernotes .
My Trial Version is expired now I am trying to use NHibernate but getting below exception while Save & Commit
“No persister for: SQLiteNHibernateDemo.Student”
using below code
ISessionFactory facory=SessionFactory.CreateSessionFactory(“FIGMD.db”, “”);
using(ISession session=facory.OpenSession())
{
using(ITransaction trans = session.BeginTransaction())
{
Student stud = new Student() { PRN = 1, Name = “Test”, Age = “32” };
session.Save(stud);
trans.Commit();
}
session.Close();
}
Hi @pkumbhar,
We have provided an extension to your trial via private support. With regard to the NHibernate error, I suspect the issue is related to how you are building the session factory, specifically around providing a mapping type for the Student
entity type you are attempting to save.
We have purchased license version of SQLCipher. Its order processed by Account Team, He sent me .sig file I want to know the License code which can be used for my development. How can I use license code from .sig file? Can you please share me the steps for the same?
I used “sqlcipher-windows-net-4.6.1” for POC purpose but when purchased It is “sqlcipher-ado-net-4.6.1” I wanted to know Is this also compatible with NHibernate or not? or It would required changes in application. Thanks in advance.
Hello @pkumbhar,
Thank you for your support of SQLCipher. It sounds as if your Account Team has provided you with the GPG signature file to verify the download package. If you did not receive the download package from your Account Team, would you reach out to us via private support (support@zetetic.net)? We can then provide you with instructions for accessing the licensed software.
Hi ,
Yes, I received license key also. I verified It with given command and It is valid. Now I wanted to know.
below information.
I used “sqlcipher-windows-net-4.6.1” for POC purpose but when purchased It is “sqlcipher-ado-net-4.6.1” I wanted to know Is this also compatible with NHibernate or not? or It would required changes in application?
Hi
Can you please check and let me know?
Hello @pkumbhar,
While SQLCipher for Windows System.Data.SQLite is the historical product that would integrate with NHibernate (due to NHibernate integrating with System.Data.SQLite), you can also use SQLCipher for Windows .NET with NHibernate as we have discussed in the earlier portion of this thread.
If you feel that the incorrect SQLCipher product was purchased and you need to exchange products so your organization would only continue to use SQLCipher for Windows .NET please feel free to reach out to us at support@zetetic.net.
Hi @developernotes ,
I am facing issue while fetching data from multiple threads
Inner Exception “database is locked”
Exception: could not execute query
StackTrace: at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters, IResultTransformer forcedResultTransformer, QueryCacheResultBuilder queryCacheResultBuilder)
at NHibernate.Loader.Loader.ListIgnoreQueryCache(ISessionImplementor session, QueryParameters queryParameters)
at NHibernate.Loader.Hql.QueryLoader.List(ISessionImplementor session, QueryParameters queryParameters)
at NHibernate.Hql.Ast.ANTLR.QueryTranslatorImpl.List(ISessionImplementor session, QueryParameters queryParameters)
at NHibernate.Engine.Query.HQLQueryPlan.PerformList(QueryParameters queryParameters, ISessionImplementor session, IList results)
at NHibernate.Impl.SessionImpl.List(IQueryExpression queryExpression, QueryParameters queryParameters, IList results, Object filterConnection)
at NHibernate.Impl.SessionImpl.List(IQueryExpression queryExpression, QueryParameters queryParameters, IList results)
at NHibernate.Impl.AbstractSessionImpl.List[T](IQueryExpression query, QueryParameters parameters)
at NHibernate.Impl.AbstractQueryImpl2.ListT
at FIG.Framework.Remoting.DatabaseAccess.DataStore.Find[T](String Predicate, NamedParameter parameters) in C:\Pandurang\SQLCipher\SQLCipherExample\SQLIteNhibernateDemo\Framework\Framework\Remoting\DatabaseAccess\DataStore.cs:line 634
at FIG.Framework.Remoting.DatabaseAccess.DataAccess.Find[T](String Predicate, NamedParameter parameters) in C:\Pandurang\SQLCipher\SQLCipherExample\SQLIteNhibernateDemo\Framework\Framework\Remoting\DatabaseAccess\DataAccess.cs:line 537
Note Same query is executing with same parameters most of the time.
Can you please suggest me ways to use database from multiple threads?
Hi @pkumbhar,
It appears you’re trying to query the database while another thread has acquired a lock on the database to perform a write operation. Does each thread have it’s own connection? If so, you might consider whether using PRAGMA journal_mode = wal;
[1] would help address the situation as readers don’t block a writer, and a writer does not block readers.
Hi @developernotes ,
I am facing issue after copying database file to new location and trying to establish a connection for new database getting below error.
“file is not a database”
Is there any other way to copy .db file while running installer?
Hi @developernotes ,
I have fixed the above issue but now I am facing another issue related to store GUID when I am storing It from NHibernate It is storing as Blob and when I am storing It from ADO.Net System.Data.SQLite It is storing as string. If I can store It as string from NHibernate then I dont need make to much changes in application.
I have tried using below Changes
.SetProperty(“format_sql”, “true”);
but still It is not working
Hi @pkumbhar,
Does something like this allow you to store the Guid as a string:
let me check and update you ASAP
Hi @developernotes ,
I am using .hbm.xml instead of mapclass. and Class poco entities definition having Guid type above code is not working as expected It is storing the Blob not string
Hi @pkumbhar,
It sounds like you might need to explore the generator options for your NHibernate mappings. NHibernate has documentation on this available here:
https://nhibernate.info/doc/nhibernate-reference/mapping.html#mapping-declaration-id-generator
Hi @developernotes ,
I wanted to know while Initialization of SessionFactory why we need to inject lisc key every time
string lisc = “my licence”;
var _connection = (IDbConnection)new System.Data.SQLite.SQLiteConnection($“Data Source=FIGMD.db;Mode=ReadWriteCreate;Version=3;”);
_connection.Open();
using (var command = _connection.CreateCommand())
{
command.CommandText = $“PRAGMA cipher_license = ‘{lisc}’;”;
command.ExecuteNonQuery();
}
using (var command = _connection.CreateCommand())
{
command.CommandText = $“PRAGMA key = '” + Key + “';”;
command.ExecuteNonQuery();
}
using (var command = _connection.CreateCommand())
{
command.CommandText = $“PRAGMA journal_mode = wal;”;
command.ExecuteNonQuery();
}
using (var command = _connection.CreateCommand())
{
command.CommandText = $“PRAGMA foreign_keys = ON;”;
command.ExecuteNonQuery();
}
_connection.Close();
When I comment the above code It is throwing error of authorization.
Is it possible to authenticate using only FileName and password. We will create database using shell and will be used in the application. We dont need to integrate my license code in application.
Hi @pkumbhar,
The PRAGMA cipher_license
command will need to be executed only at application startup (it will remain in memory). It is not possible to provide this value via the connection string. The license code does not expose the encryption key for the database which is separate, it only allows the library to perform encryption operations.
If my application restarts that time also It needs to be set PRAGMA cipher_license? or It will use from memory?