Override == (equality) operator in NHibernate?
With NHibernate entities, you are meant to override Equals and GetHashCode. Is it a good idea to override the == operator to use the .Equals implementation also? ...
With NHibernate entities, you are meant to override Equals and GetHashCode. Is it a good idea to override the == operator to use the .Equals implementation also? ...
I started using NHibernate this week (struggling). I have a small application with 3 tables (I use 2 for now). Table currency and table country here are the mapping files. <class name="dataprovider.Country,dataprovider" table="country"> <id name="CountryId" column="country_id" unsaved-value="0"> <generator class="native"/> ...
I want to convert a NHibernate CreateCriteria over to a NHLambdaExtensions criteria, but I'm getting errors that I don't know how to fix. The NHibernate criteria looks like this: var departments = DepartmentService .CreateCriteria() .CreateAlias( "Goals", "goal" ) .Add( Expression.Eq( "goal.Company.Id", companyId ) ) .A...
I have a couple of entities that I want to treat as an aggregate. The problem is their association is conceptual rather than via foreign keys in the DB. The schema I was given: My goal is to create an InventoryWeek class that I add inventory transactions to. So the inventory week obviously wraps FACIL_INVENTORY_WEEK and the transact...
What happened to Hibernate.org? I get redirected to jboss.org and then once on that site I can not find it. Does this mean that hibernate is no longer an independent project - it is now a component of jboss. ...
I know about the not-null attribute. Is there one for enforcing the minimum length of a string property? I don't want empty strings in my database. ...
I'm using .net 2.0 with NHibernate/ActiveRecord and WCF. I haven't been using NH Lazy load so far, but the performance penalties are too big to ignore, so I'm starting to use it. From what I've read so far, it's not an easy subject, using NH entities with lazy loading and serializing to WCF, but the benefits are too great to ignore. U...
Hi, banging my head here and thought that some one out there might be able to help. Have Tables below. Bucket( bucketId smallint (PK) name varchar(50) ) BucketUser( UserId varchar(10) (PK) bucketId smallint (PK) ) The composite key is not the problem thats ok I know how to get around this but I want my bucket class to contan...
Summary: OSS Technologies that fit with MS C#, Dot Net, and VS enterprise development. I am not trying to be subjective. I need a finite list of MS C# specific enterprise practices with matching OSS software titles that work with MS MVC (outlined below). From there I can review and setup a "hobbie kit" installer for my dev team. I wa...
I have a Member Table with fields MemID - Primary Key Business_Name Business_Address Business_Phone I need to make an Employer Class which has properties that come from the same Members Table. EmployerName EmployerAddress EmployerPhone Here is my Employer Mapping <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" auto-import="true"...
Is it possible to creat a readonly connection in nHibernate ? Read-only : where nHibernate will not flush out any changes to the underlying database implicitly or explicitly. When closing a nhibernate connection it does automatically flush out the changes to the persistent object. Setting the flush mode to never is one way - but is r...
I have a class, Order, which I persist to a database using NHibernate. There is a folder futher down in the web application that contains an object that inherits from Order, for our purposes, we can call it CustomOrder. I use CustomOrder to place a few properties onto the Order object for UI purposes. The properties don't actually hav...
It took me a long time but I finally got nHibernate's Hello World to work. It worked after I did "lazy loading." Honestly, I couldn't tell you why it all worked, but it did and now I am reading you don't need lazy loading. Is there a hello world that anyone has that is bare bones making nHibernate work? Do you have to have lazy loadi...
Aside from the language used (Java, C#, etc.), are articles and books for Hibernate equally good for nHibernate? Now that I am learning I want to research but I don't want to waste time on the wrong information. Thank you. I have a very basic CRUD database project for learning if anyone has any all in one article. EDIT: I bought the...
Howdy, I have a mapped entity, Matter, that has a mapped component, Injury. The only property on the Injury is DateOfInjury which is a nullable datetime. When I retrieve the Matter, if the DateOfInjury is null, the component is null. Thus something like this matter.Injury.DateOfInjury will throw. Could someone explain if I am doing ...
The following is a simplification of my problem domain. We have a series of Trades, that each gets a record in Valuations every business day. We filter our Valuations List used for a specific day, but to populate the Trade against each of the Valuation rows, NHibernate fires single row selects on the Trades table for around 50k rows in ...
Hello, I am fairly new to nHibernate and DDD, so please bear with me. I have a requirement to create a new report from my SQL table. The report is read-only and will be bound to a GridView control in an ASP.NET application. The report contains the following fields Style, Color, Size, LAQty, MTLQty, Status. I have the entities for S...
Hello, I'm having a problem mapping a column in table A to a property of a class, which is primarily mapped to table B. The following explains this better: There's a class CustomerRisk, which has properties Risk and CustomerNumber. In the database, this consists of two tables: Customer, which has a column CustomerNumber, and CustomerRi...
I have a class A containing a list of B mapped like that <class name="A" table="CLASS_A"> ... <idbag name="ListOfB" table="CLASS_A_CLASS_B" cascade="save-update"> <collection-id column="ID" type="Guid"> <!-- surrogate key --> <generator class="guid.comb"/> </collection-id> <key c...
I have a one-to-many relationship but I'd like to get only one instance to have a one-to-one relationship. I have a class vehicles that may have several owners throughout their life. I only want to map the class to obtain the assets. Is there some way to do this? The problem is in the hbm.xml file. One vehicle may have several owners t...