I'm working with an object model in Castle ActiveRecord that represents pregnant women. It's a simple tree structure:
Patient
Visit
Delivery
A Patient has 0 or more Visits and a Visit has 0 or more Deliveries. I've mapped everything to the database, and I can loop through the Patient>Visit>Delivery hierarchy and print out ever...
I have been reading about using nHibernate and multiple datasources and I get the multiple session factory piece and making multiple calls to the db.
I need to know if I can maintain the "has-a / has-many" relationships in the model if the data resides in different data sources. Is there a way to cascade saves and such?
I apologize ...
I can't for the life of me find a good NH ICriteria walkthrough. Can anyone assist in pointing one out?
...
As per the StackOverflow question 'NHibernate and sql timestamp columns as version', I use the following mapping:
<version name="RowNumber" generated="always" unsaved-value="null" type="BinaryBlob">
<column name="RowNumber" not-null="false" sql-type="timestamp" />
</version>
<property name="CreateDate"...
When using Castle ActiveRecord, how would you implement this query:
SELECT vote, COUNT(*) FROM VotesOnQuestions WHERE questionid = x GROUP BY vote
I would like to count all votes on a question, and group this by the vote value.
...
I'm using Active Record with ActiveRecord Facility, and am trying to use a custom NHibernate query. Do I need to define a mapping for a class even though it extends ActiveRecordBase and has ActiveRecord attribute?
[ActiveRecord("VotesOnQuestions")]
public class VoteOnQuestion : ActiveRecordBase<VoteOnQuestion>
{
[CompositeKey]
p...
I'm a complete noob to NHibernate & ActiveRecord.
What would you say is the best way to start using them productively - following the manuals step by step, or progress in small steps by actually using it and cross the problems as I encounter them?
...
If my application spans multiple databases, i.e. users 1-10K on server1, 10-10K on server2 (for example), how can I modify my session object to point the correct database?
From what I understand, if I change the connection string in nhibernate's session it will effect everyone and not the current request correct?
...
When I try and load an entity by ID using:
Session.Load(21);
I get a 'no row with the given identifier exists'.
In my code I was checking for null like:
if(user == null)
How am I suppose to know if the row didn't exist, or how can I make it return null instead?
...
I've started digging into Nhibernate and although there are many things I do like, there is one ting I dislike: the "generate proxy"/lazy load mechanism. The idea that I have to maintain some sort of reference to the ISession and make sure the entities are associated with the session before accessing a property that might trigger lazy-lo...
I found what I thought was a great article by Ayende on creating a simple base test fixture for NHib unit testing with SQLite.
My question here is the code for a test case in concrete test fixture. In EX_1 below, Ayende wraps both the save a fetch in a transaction which he commits, and has a Session.Clear in between. This works, or cour...
can you delete using criteria query?
I want to do:
DELETE bookmars
WHERE userID = @userID
How can I do this with criteria?
...
Say I have a class, e.g.:
public class Person
{
public virtual int Id { get; set; }
public virtual string Name { get; set; }
public virtual int SpouseId { get; set; }
public virtual Person Spouse { get; set; }
}
I have included the SpouseId because that is the out-of-the-box way to model bind using (Try)UpdateModel (ba...
Hi All
What is the difference between Nhibernate Session.Get and Session.CreateCriteria?
My story is:
In our product we implemented a softDeletion by adding a Interface ISoftDeletable, each class which implement this Interface has deletedDate and deletedBy field. Also we have AuditableEntity class which means that each class which imp...
I have an Area object which has many SubArea children:
public class Area
{
...
public virtual IList<SubArea> SubAreas { get; set; }
}
he children are mapped as a uni-directional non-inverse relationship:
public class AreaMapping : ClassMap<Area>
{
public AreaMapping()
{
HasMany(x => x. SubAreas).Not.Inverse()...
Has anyone managed to get nhibernate.search (Lucene) to work with S#arp Architecture? I think I have it all wired up correctly except Luke shows no records or indexes when I run my indexing method. The index files for the entity are created (segments.gen & segments_1) but both are 1kb in size which explains why Luke shows no data.
I e...
Persistence ignorance is typically defined as the ability to persist & retrieve standard .NET objects (or POCOs if you really insist on giving them a name). And a seemingly well accepted definition of a standard .NET object is:
"...ordinary classes where you focus on the business problem at hand without adding stuff for infrastructur...
I'm new to NHibernate (+Fluent), and I can't decide on what's the best strategy when it comes to structuring my code to make it testable. I have a plain structure including a domain model, mappings to map the model to database, and a few classes with behavior which will work towards the model classes and do transactions for updating and ...
Hi
I'm having a project where I'm using nhibernate as orm in my repositories. But after some CQRS reading I want to try and "copy" some of my data to other tabels for view quering/reporting.
Meaning when for instance a new customer is created, I would like some of the customer and company information copied to another table, using some ...
I get an exception after upgrading Spring.NET 1.2 to 1.3 in my web application. Here's the setup on my web app:
I created an application pool with its identity set to ApplicationPoolIdentity. I use NHibernate 2.1, my SQL Server 2008 is local and I'm using SQL server authentication. There's no network or shared folder. Everything is loca...