I'm using SQLite (system.data.sqlite v. 1.0.60.0) on a Fluent NHibernate project.
I have one program that writes to the DB, and another that reads from it. Occasionally, I get SQLITE_BUSY exceptions, and I need to fix this.
I found several Google references to sqlite_busy_timeout, which (if I understand correctly) will cause SQLite to...
Hi, looking at an existing NHibernate implementation that maps a single class to two database tables that are joined. The current functionality is read-only. The table join is actually hidden away via a readonly view and it's the view that's referred to in the NHibernate mapping. Works fine for readonly behaviour. Except I need to add I...
Hello guys. I've got common scenario: SL app and wcf service as data source. I use dtos for transport business objects over the wire. I get issue - Update entity. At client form I have binded dto and send to wcf. I want to know nice way update real db entity by dto data. At wcf I use Nhibernate DAL. My way is getting attached entity by i...
Ayende has an article about how to implement a simple audit trail for NHibernate (here) using event handlers.
Unfortunately, as can be seen in the comments, his implementation causes the following exception to be thrown: collection xxx was not processed by flush()
The problem appears to be the implicit call to ToString on the dirty pro...
So my unit tests are green, time to integrate this shiny new NHibernate-driven DAL in to my web app! I don't really want to maintain two configuration files so I've migrated hibernate.cfg.xml in to my Web.config file (i.e. I copypasta'd the contents of hibernate.cfg.xml in to my Web.config). Here is the relevant bits from my Web.config:
...
Normally the parameterized SQL works great for CRUD, but I have one instance where I want to use a stored procedure to do an insert.
My HBM file has the following (along with a bunch of other properties, bags, etc)
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="MyProject.Entities" assembly="MyProject">
<class name="...
I've heard this can also be accomplished with triggers, but I'd rather not go that road if I can. Right now it seems like nulling references to child objects just leaves them orphaned in the database, which isn't ideal to say the least.
Thanks!
...
I have an object where I maintain a relationship to another object:
public class Foo {
public Bar Bar { get; set; }
}
In the mapping I reference Bar to that I can maintain the relationship - I don't want the parent object to update properties in the child, just the existence of the relationship:
References(x => x.Bar, "BarId")
...
Hi,
I am using NHibernate for ORM, and everything works fine.
Now I started to write some unit-tests (using the DB, I do not want to put tooo much effort in abstracting this away, I know its not perfect, but it works..).
I need to be sure that the DB is completly empty for some tests. I can, of course, create the whole DB. But that ...
Has anyone seen the following exception and knows what the cause is. Recently deployed code live and started seeing exceptions which forced roll back. On Windows Server 2008 and IIS7.0. The full stack trace seen below.
NHibernate.HibernateException:
Creating a proxy instance failed --->
System.Runtime.InteropServices.COMExcep...
Hi all, I need to develop a system that grant or deny access to specific fields of entities mapped with nHibernate.
Let's say I have the entity "Customer" that is exposed to the web through a WCF Service, (I use a WCF RIA Services, anyway that's not the point) and accordingly to the current user I must set the "SSN" field as visible or...
I have figured out a lot about nhibernate, but this seems to be my final hurdle of not understanding what is going on. So here is the problem.
I have a basic databas structure:
Shows:
ID [Pk]
CountryID [Fk]
Name
Countries:
ID [Pk]
Name
CountryID has a foriegn key reference from shows to countries table primary key, and countries is ...
Let's say I have the following entity:
public class CalculationInfo
{
public virtual Int64 Id { get; set; }
public virtual decimal Amount { get; set; }
public virtual decimal SomeVariable { get; set; }
public virtual decimal SomeOtherVariable { get; set; }
public virtual decimal CalculatedAmount
{
ge...
At the company I work we have a single database schema but with each
of our clients using their own dedicated db, with one central db that
stores client contact details and what database the client is using so
we can connect to the appropriate db. I've looked at using NHibernate Shards but it seems to have gone very quite and doesn't...
Hello,
I'm building C#/.Net 3.5 app using three layers: UI (view/view models), service, and data access/persistence.
Service Layer:
Each service layer instance is associated with a unique persistence instance. The service layer references the persistence layer via an interface.
Persistence Layer: Right now, the persistence layer in...
I have a need to perform a complex left join on a table and am unsure how to write the code using a criteria query. Currently I have:
public IList<RezolutionConfig> GetSearchConfigByManagerCategoryProduct(int ManagerId, int ProductTypeId, int ConfigCategoryId)
{
ICriteria criteria = Session.GetISession().CreateCriteria(typ...
Hi guys,
I would like to know how to deal with nested transactions e.g. Between
one begin and comit, I have another begin and comit. The reason I am
asking you is because in my ApplicationServices project I have
services that depends on other services. And a method of a parent
service begins a transaction and depending upon some logic, ...
Hi guys,
I am facing an unusual behaviour with the Repository and Transactions
and its making me mad.
I have two simple POCO classes Action and Version as follows. There is
a one to many relationship from Action->Version.
public class Action : Entity
{
public virtual string Name
{
get;
set;
}
public vi...
I know it seems like a silly question, but its not clear from the castle project page/documentation.
I would need a version compatible with the latest version of NHibernate (2.1.2). Should I get the latest source from the github trunk and build it, or is there another place I should get it from?
...
Does anyone know of a quick way to have NHibernate insert default values for value types as null into the database?
For example:
public class Foo
{
public int SomeProperty { get; set; }
}
By default, int is 0. When it goes into the database, I would like it to go in as null.
I know I could do this by changing SomeProperty to a nu...