My hbm2hbmxml task is generating ids such as below
<id name="id" type="long">
<column name="id" />
<generator class="assigned" />
</id>
I'd like them all to be "native". Can I configure the Hibernate reverse engineering to do this?
Thx,
Fred
...
I'm using ASP.NET MVC + NHibernate + Fluent NHibernate and having a problem with lazy loading.
Through this question (http://stackoverflow.com/questions/2519964/how-to-fix-a-nhibernate-lazy-loading-error-no-session-or-session-was-closed), I've discovered that I have to implement the Open Session in View pattern , but I don't know how.
...
Hi,
I am having problems with the following query in Castle ActiveRecord 2.12:
var q = from o in SodisceFMClientVAR.Queryable
where taxnos2.Contains(o.TaxFileNo)
select o;
taxNos2 is an array of strings.
When run I get an exception:
+
InnerException {"Index was out of
range. Must be non-negative and ...
Let's get this out of the way first: I know that SessionFactory is immutable - I'm trying to change the Configuration at runtime and regenerate ISessionFactory.
Specifically, I have a Customer mapped that will have some fields added to its dynamic-component node at runtime. I would like to do something like this
var newSessionFactory ...
I have a situation in which the ideal relationship, I believe, would involve Value Object Inheritance. This is unfortunately not supported in NHibernate so any solution I come up with will be less than perfect.
Let’s say that:
“Item” entities have a “Location” that can be in one of multiple different formats.
These formats are comp...
I've just started doing some real-world performance testing on my Fluent NHibernate / SQLite project, and am experiencing some serious delays when when I Commit to the database. By serious, I mean taking 20 - 30 seconds to Commit 30 K of data!
This delay seems to get worse as the database grows. When the SQLite DB file is empty, com...
I have a situation where I need NHibernate to ignore its caches and just hit the database because the data has changed (another user on another computer has changed the data). How is this possible? So far I have had no luck. Get, Load, Linq query, doesn't matter. NHibernate is not getting the most recent data.
...
I have an NHibernate query that looks like this:
var query = Session.CreateQuery(@"
select o
from Order o
left join o.Products p
where
(o.CompanyId = :companyId) AND
(p.Status = :processing)
order by o.UpdatedOn desc")
...
Hi all.
In an n-tier architecture, the best place to put an object-relational mapping (OR/M) code is in the data access layer. For example, database queries and updates can be delegated to a tool like NHibernate.
Yet, I'd like to keep all references to NHibernate within the data access layer and abstract dependencies away from the lay...
I'm dealing with a legacy database that has date and time fields as char(8) columns (formatted yyyyMMdd and HH:mm:ss, respectively) in some of the tables. How can i map the 2 char columns to a single .NET DateTime property? I have tried the following, but i get a "can't access setter" error of course because DateTime Date and TimeOfDay...
When working with NHibernate and Sql Compact in a Windows Form application I am wondering what is the best practice for managing connections. With SQL CE I have read that you should keep your connection open vs closing it as one would typically do with standard SQL. If that is the case and your using a IoC, would you make your repositori...
I'm sure this has been answered before, but I've spent the last three hours looking for an acceptable solution and have been unable to find anything, so I apologize for what I'm sure is a repeat.
I have two domain objects, Player and Position. Player's have a Position. My domain objects are POCOs tied to my database with NHibernate. I h...
Hello,
In my quest to further my knowledge, I'm trying to get get NHibernate running.
I have the following structure to my solution
Core Class Library Project
Infrastructure Class Library Project
MVC Application Project
Test Project
In my Core project I have created the following entity:
using System;
namespace Core.Domain.Model
...
Is it possible to do eager loading with HQL without touching mappings? The "left join fetch" expression is completely ignored by nHibernate.
var query = Session.CreateQuery("from o in Member left join fetch o.Photos");
query.List<Member>();
The generated SQL is
SELECT this_.Id as Id7_1_, this_.Name as Name7_1_, this_.AltNames as Alt...
Hi,
I begin my NHibernate mapping. In major cases I use int type but for some entities I need to persist million of objets. Is long type for identity will be the best choice ?
...
Can somebody tell me what lazy-loading policy NHibernate uses? Various sources provides contradictory information - this one says that NHibernate doesn't provide lazy-loading for properties, and NHibernate in Action read that lazy-fetching are on by default. Am I missing something?
...
Hello,
I am using NHibernate in my project, but I dont like to use typed properties for selecting items from database.
Is it possible to have instead of
session.CreateCriteria(typeof(IEntry)).AddOrder(Order.Desc("Alias"))
somthing like this
session.CreateCriteria(typeof(IEntry)).AddOrder(Order.Desc(x=>x.Alias))
Thanks,
Alexander...
Given a database that has numerous repeating columns used for auditing and versioning, what is the best way to model it using NHibernate, without having to repeat each of the columns in each of the classes in the domain model?
Every table in the database repeats these same nine columns, the names and types are identical and I don't want...
Hi,
Is there a way in NHibernate to get the foreign key of a child object, without fetching the child object?
EG.
I have User and UserRole. Can I access User.UserRole.UserRoleId without causing another hit on the database to retrieve UserRole?
I realize I can set fetch mode to eager and this will stop it from hitting the database aga...
I'm trying to map int IdPost on DTO to Post object on Blog object, based on a rule.
I would like to achieve this: BlogDTO.IdPost => Blog.Post
Post would be loaded by NHibernate: Session.Load(IdPost)
How can I achieve this with AutoMapper?
...