Does NHibernate support mapping from SQL Views?
Does NHibernate support mapping of SQL VIEWS? Any examples would be helpful. ...
Does NHibernate support mapping of SQL VIEWS? Any examples would be helpful. ...
I am using NHibernate in a DAL layer dll. Local config file(app.config) is being used for db connection. This DAL component can be used in 2 different exe's and a NUnit test harness. Business requirement from Client is to have config information reside in exe's app.config file. Is there a way to configure NHibernate to look for an ap...
Hi all, I'd like to run a criteria query with lazy many-to-one associations. Those associations are set as lazy="false" in the HBM. It's because we use it eagerly 90% of the project. But there are a few 'big' queries that should run as lazy="proxy". HBM: <many-to-one name="DestinationElement" class="X" column="DstElemId" not-null="tr...
I'm hoping to display a list of all of the products ordered. I can display this using the following sql statement select products.Id,count(products.Id), products.Name from Products inner join orderitems on Products.Id = orderItems.ProductId left join orders on orderItems.OrderId = orders.Id where orders.CompanyId = 27 group by products....
Yesterday, I upgraded my NHibernate application from 1.2 to 3.0. I get the following exception c.SubContractors is not mapped [SELECT count(distinct c) FROM CallUp c, c.SubContractors sc Where sc.id = :id AND c.ChildCallUp IS NULL AND c.State > 0 AND (:start_date BETWEEN c.ContractStartDate AND c.ContractEndDate OR :end_date BETWEEN c.C...
Hello everyone, I'm trying to break the question down to something simple. I use nhibernate to get a list of entities via a criteria call. After that I'll update some entites and add one entity which I save (session.SaveOrUpdate(entity)). When I get a list with a criteria again I do get the entities that were changed (with changed valu...
It seems that when using the following NHibernate query, I do not get a root entity when the left outer join has no records. ICriteria critera = session.CreateCriteria(typeof(Entity)); criteria.CreateCriteria("SubTable.Property", "Property", NHibernate.SqlCommand.JoinType.LeftOuterJoin); criteria.Add(Expression.Not(Expression.Eq("Prop...
.NET 4.0 don't use medium trust it got a different kind of security, does that mean it's ok to use like NHibernate on hostings that support .NET 4.0? I mean straight out the gate with it no modifications with proxy. ...
Does Hibernate + NhibernateLINQ support projection of inner objects. for eg. when I try the following I get an Index out of bounds exception on Patient object on the call to Queryable.ToList() var registrations = from r in _session.Linq<Domain.Registration>().Expand("Patient") select r; var queryable = registration...
I'm having some issues with a many-to-many relationship I am trying to create. The goal is to save a customer and which products they are allowed to purchase. The products are not unique to a customer and will ALWAYS exist in the database before we try to associate a customer to them. My mapping for the association currently looks lik...
In action I taken some data from db. Now in view I want to take value from one field which is referenced from other table with lazyload, by I get this error: Could not initialize proxy - no Session I wonder what I can do now. public ActionResult Index() { using (NHUnitOfWork.Start()) { va...
Hi all, It's a long time I'm working with NHibernate session through frameworks like Castle ActiveRecord but never understood what is a session exactly and how should manipulate. Can anybody help? Is there any concise resource? Thanks in Advance ...
Hello all, I have the following HQL query: return Session.CreateQuery("from Player p where p.Sex = :teamSex and p.Visible and not exists (from PlayerInTeam pit where pit.Player = p and pit.Roster.Team = :teamId)") .SetParameter("teamId", team.Id) .SetParameter("teamSex", team.Sex) .Enumerable<Player>(); How would you writ...
I have the following collection ( see image ) . I wish to parse this into List. I have tried NHibernate's "Transformers.AliasToBean" Like so var result = _session.CreateQuery(hql) .SetResultTransformer(Transformers.AliasToBean(typeof(OrderProduct))) .List(); Tho i'm gettin...
Hi, I am in big need of help. I am making dynamic query using Criteria: ICriteria query = session.CreateCriteria(typeof(Employee)); if (searchOptions.FirstName != null) { query.Add(Expression.Eq("FirstName", searchOptions.FirstName)); } if (!searchOptions.LastName != null) { query.Add(Expression.Eq("LastName", searchOptions.Last...
in NHibernate, i invoke delete but update is invoked automatically!! i use FluentNhibernate Automapping. ...
Hi In the mapping-file I've defined a bag for Positionen. <class name="Animag.DomainModels.Models.Abrechnung, Animag.DomainModels" table="Abrechnungen" lazy="true"> <id name="ID" column="ID"> <generator class="native"/> </id> <version name="Version" column="Version"/> <many-to-one name="Kunde" column="KundeID" c...
In this question, the user asks the better way to close sessions because he was having some errors. The most voted answer is Ayende's answer that says: You should always use session.Dispose(); The other are for very strange occurances Should I really always call session.Dispose()? Isn't enough to call session.Close()? ...
Hi In the mapping-file I've defined a bag for Positionen. <class name="Animag.DomainModels.Models.Abrechnung, Animag.DomainModels" table="Abrechnungen" lazy="true"> <id name="ID" column="ID"> <generator class="native"/> </id> <version name="Version" column="Version"/> <many-to-one name="Kunde" column="KundeID" c...
There must be a simple solution out there, I'm trying to use NHibernate Validator attributes on my DateTime properties. If the value is null (via [NotNull]), I want it to fail validation. When I submit a null value it gets converted to 1/1/0001 12:00:00 AM and NHibernate doesn't pick that up as null. I guess I could write a custom valida...