Following the theme of other threads.
What are your most favorites tricks or techniques involving Hibernate?
My favorite is binding non-Hibernate generated classes to existing classes with additional functionality (i.e. summarization).
...
I've not yet found a clear answer to this and to clarify:
With nHibernate and SQL server are you expected to disregard or migrate your business logic stored in your stored procedures, views and triggers into HQL or application code?
...
I am going to build a search function today, c# asp.net. i need a push go get it rolling. i use nhibernate linq. it would be nice to do this with linq query. it need to be kinda dynamic, i am going to have several search criterias like gender, email, name, age and some more.
this search query is only going to my customer object.
how ...
Alright, I've got a quick question. I'm currently working with a legacy database, so I can't change around much. The database revolves around a single type, the entity. All other relevant data (except for customizable lists etc.) 'inherit' from this.
I'm mapping this with a joined subclass approach, which is working fine. The problem ho...
Hi,
This is a bit of conceptual questions but I think it’s the right place to ask it.
i am working with NHibernate for some time but I find it difficult to use the collections within the POCO objects
1. I think the proxy concept is nice but when you want o use it in multi tier architecture it become a challenge.
2. I want to add a busin...
Hello guys... My hbm is :
<class name="Core.clsPessoa,Core" table="tblPessoa" lazy="true">
<id name="ID" column="CodigoPessoa" type="Int32" unsaved-value="0">
<generator class="identity"/>
</id>
<property column="CodigoCEP" name="CodigoCEP" type="String" />
<joined-subclass name="Core.clsPessoaJuridica,Core" table="tblPessoaJuri...
I am considering bringing NHibernate into a project but have a question on how read only DTOs would be implemented. Entities are easy, but what about scenarios where you have a field our two from multiple entities/tables that need to be mashed together for display data on a view. Surely it would be overkill to load up all of the entities...
I've been seeing a lot of commentary (from an NHibernate perspective) about using Guid as opposed to an int (and presumably auto-id in the database), with the conclusion that using auto-identity breaks the UoW pattern.
This post has a short description of the issue, but it doesn't really tell me "why" it breaks the pattern (unless I'm m...
I'm having trouble with saving an object into my database using NHibernate.
My code looks like this:
Image image = new Image { Url = 'test.jpg' };
Product product1 = new Product { Name = 'MyProduct', Image = image };
Product product2 = new Product { Name = 'MyProduct2', Image = image };
MySession.Save(product1); // This also creates a...
I have 3 DB Tables: Person, Address, and PersonAddress. Person Address is a simple join table (only stores the IDs of Person and Address).
In my domain model, I have Person and Address. Person is configured to have a many-to-many relationship to Address (through PersonAddress). In code, this is implemented with List<Address>.
I've been...
I'll try to keep this terse, but hopefully won't miss any important information in my troubles. The code I believe provides all details, but I've left out the noise (it's VB, so there's lots of noise :) ).
A "Case" object has many "Assignments":
Public Class Case
Property CaseId As Guid
Property Assignments As ISet(Of CaseAssignm...
Situation:
I have a class MyClass and its "lightweight" version MyClassLite, so i have
public class MyClass : MyClassLite
I also use hbm file for mapping my classes (they are mapped to the same table).
The thing is that when i try to get a list of MyClassLite entities, i get not only MyClassLite entities, but a list of MyClass entitie...
I have an interface, called IRepository.
One of the methods in this interface is:
IEnumerable<T> FindByQuery(Expression<Func<T, bool>> predicate);
I then have (for example) an IUserRepository, that implements IRepository.
In my implementation of IUserRepository, currently called LinqToSqlUserRepository, i have implemented the FindByQ...
I have read some post about fetch=join - http://nhforge.org/blogs/nhibernate/archive/2009/04/09/nhibernate-mapping-lt-many-to-one-gt.aspx (ser4ik.livejournal.com/2505.html)
So I have some question, Forexample I have class
<class name="AttributesInf" table="attr_inf">
<id name="Id">
<generator class="identity"/>
</id>
<proper...
Okay, I hope this makes sense!
I have an object Box which contains Items in it. The database design is such that only inserts are done on the Items table, and negative quantities are inserted to represent items being removed from the box. For example, if you put 10 items in the box, and remove 3 items, this would result in 2 rows in the...
I'm having an issue mapping what I would think is a fairly simple association.
Here's an example of the domain model I'm trying to map:
public class MyClass
{
IDictionary<string, DateTime> Dates { get; set; }
}
public class MyOtherClass
{
IDictionary<string, DateTime> Dates { get; set; }
}
I'd like the Dates property to be ...
I've read that using a back tick ` should allow for using of reserved words. I'm using SQL Server and Fluent NHibernate and have a column name "File". If I map it with
"`File"
it tries using
[Fil]
so it's adding the brackets correctly, but dropping the "e" from the end. If I map it as
"`Filee"
it uses
[File]
correctly.
Am ...
I have a query I've written with NHibernate's Criteria functionality and I want to optimize it. The query joins 4 tables. The query works, but the generated SQL is returning all the columns for the 4 tables as opposed to just the information I want to return. I'm using SetResultTransformer on the query which shapes the returned data t...
I know this has been asked and answered a number of times, but I have two classes that are many-to-many. I've reciprocal mapped them using bags. Here is the NHibernate Mapping:
Calendar:
<?xml version="1.0" encoding="utf-8"?>
<!--Generated by NHibernate.Mapping.Attributes on 2009-10-09 18:09:29Z.-->
<hibernate-mapping xmlns="urn:nhibe...
Is there a way in fluent nhibernate to map a DateTime to rehydrate my entity with DateTime.Kind set to Utc rather than unspecified? I'm currently persisting a DateTime that is Utc, but the Kind coming back is always Unspecified, throwing off my time.
...