Hi,
I have a Product Class which has a one to many relationship to a Price class.
So a product can have multiple prices.
I need to query the db to get me 10 products which have Price.amount < $2. In this case its to populate a UI with 10 items in a page.
so i writ the following code:
ICriteria criteria = session.Create...
Hi guys do any of you working on a large enterprise or web application what uses Nhibernate as an ORM tool ,I interested to know about your experience ? Or maybe you have a link for such an example ?
...
Assuming that writing nhibernate mapping files is not a big issue....or polluting your domain objects with attributes is not a big issue either....
what are the pros and cons?
is there any fundamental technical issues? What tends to influence peoples choice?
not quite sure what all the tradeoffs are.
...
In my domain model I have an abstract class CommunicationChannelSpecification, which has child classes like FTPChannelSpecification, EMailChannelSpecification and WebserviceChannelSpecification. Now I want to create an HQL query which contains a where clause that narrows down the result to certain types of channel specifications. E.g. (i...
I have a many to many relationship using NHibernate.
Is there an easier way of removing the category association from all products without creating an class for the Join Table?
I'd like the SQL to look like
DELETE FROM ProductCategories WHERE CategoryId = 123
and here's the code we're using to delete the associations
Detach...
Hi, any help you can give is very gratefully accepted. I've been looking at this problem over and over and cannot seem to find the solution. Its probably staring in me in the face :(
I have the following class with a list of parents and children to be persisted in a Hierarchy table.
class Item
{
public virtual int Id {get;set;...
Hi, I'm trying to code the following HQL query using the Criteria API:
var userList = _session
.CreateQuery("select u from User u where u.Role.ID=3 and u.Customer.ID=:cID")
.SetInt32("cID", 1)
.List<User>();
(3 NHibernate objects : User(ID, Name, Role, Customer), Role(ID, Name) and Custo...
I'm so surprise while I'm working in Fluent NHibernate. I got my legacy database that has primary key column name is different from my property in domain model. I'm sure that I can use this mapping file:
<class name="Person">
<id name="Id" column="CommentId">
<generator class="native"/>
</id>
<property name="Description" typ...
Say I have these table in an Oracle database
Person:
PersonId <- PK ID (int, from sequence)
PersonFirstNameID <-- int
PersonLastNameID <-- int
PersonSecurityID <-- int
PersonDetails
PersonFirstNameID -CompositeKey
PersonLastNameID -CompositeKey
PersonSecurityID -CompositeKey
PersonDetailKey
PersonDetailValue
PersonDetailRisk
Now I wan...
I am starting a job with a mid size company working mostly on writing custom apps that interact with their ERP system. This is my first time doing this sort of work, so the ERP concept is new to me and I am learning it piece meal.
I have only written two apps so far and have learned the database model as I went and only as much as I n...
Is it possible to view the mapping configurations / mapping xml files passed from activerecord to nhibernate?
...
I have the following Unit Test method:
void TestOrderItemDelete()
{
using (new SessionScope())
{
var order = Order.FindById(1234);
var originalItemCount = order.OrderItems.Count;
Assert.IsTrue(originalCount > 0);
var itemToDelete = order.OrderItems[0];
itemToDelete.DeleteAndFlush(); // ite...
I'm wondering if there is a way to get SchemaExport to generate and identity column for a generated property.
<id name="Id" column="Id" type="Guid">
<generator class="guid.comb" />
</id>
<property name="OrderNumber" column="OrderNumber" type="Int32" generated="insert"/>
With the mapping above, ShcemaExport does not make the OrderNu...
I'm trying to set up a small app to experiment with NHibernate in visual studio but I'm not getting far.
The error I get is: "Could not find the dialect in the configuration".
I've tried specifying settings in both app.config and hibernate.cfg.xml but neither seems to work. These files are in the same directory as my app source (tried...
I'm a student currently dabbling in a .Net n-tier app that uses Nhibernate+WCF+WPF.
One of the things that is done quite terribly is object graph serialisation, In fact it isn't done at all, currently associations are ignored and we are using DTOs everywhere.
As far as I can tell one method to proceed is to predefine which objects and ...
Hi,
I have a rather strange error with NHibernate. I am was having error with ISession been shared by across threads and got this resolved by supplying my own ADO.NET connection like:
IDbConnection connection = new SqlConnection(ApplicationConfiguration.ConnectionString);
connection.Open();
ISession...
I'm working on a project that has a rich object model with various sets of aggregate roots.
We're using the Castle stack (Monorail through to nHibernate with ActiveRecord).
We have marked the aggregate roots as lazy [ActiveRecord(Lazy = true)] and have customized 'eager' routines on our Repository to eager fetch an object graph. We us...
I have an NHibernate Dao..lets call it MyClassDao for want of a better name.
I am writing the following code.
MyClassDao myDao = new MyClassDao();
var values = myDao.GetByCriteria(Restrictions.Eq("Status", someStatusValue));
I am using this in a Unit Test to pull back values from the database. However, it is taking over 30 seconds t...
Having fallen behind in the world of ORM and modern data access, I'm looking to move away from DataSets (shudder) and into a proper mapping framework.
I've just about got my head around Linq to SQL, an I'm now looking into NHibernate with the view to using it in our next project.
With old school sql and data sets, your sql queries obvi...
Hi,
On my quest to learn NHibernate I have reached the next hurdle; how should I go about integrating it with StructureMap?
Although code examples are very welcome, I'm more interested in the general procedure.
What I was planning on doing was...
Use Fluent NHibernate to create my class mappings for use in NHibs Configuration
Implem...