Getting DATEPART in HQL or Criteria ?
How can i get DATEPART of a time using HQL or Criteria ? I have googled it up and get some tips, but wasn't enough. If there is someone who has experienced it before, please let us know. Thanks in advance ...
How can i get DATEPART of a time using HQL or Criteria ? I have googled it up and get some tips, but wasn't enough. If there is someone who has experienced it before, please let us know. Thanks in advance ...
I've set up a one-to-many association in NHibernate: Parent (1 -> ∞) Child The problem I now face is that when I set Child.Parent, the Parent.Children collection doesn't automatically contain the new Child. Similarly, when I add a Child to the Parent.Children collection, the Child.Parent property is still null. I could write some co...
Question says it all really, the default is for it to map as a string but I need it to map as an int. I'm currently using PersistenceModel for setting my conventions if that makes any difference. Thanks in advance. Update Found that getting onto the latest version of the code from the trunk resolved my woes. ...
I have a very weird problem: sometimes when I call nHibernate update to an entity and it works, and some times it does nothing, in the same call. When it doesn't do the update, nHibernate does not return an exception or anything like that. It simply does nothing. Have you ever had this kind of trouble? ...
I am implementing a tree think of it as a folder structure so I have a class that looks like: public class Folder { //Various Props like Name etc. public IList<Folder> Children{get;} public Folder Parent {get;} } Now what I want is to be able to walk up and down the tree so given a root I can find a leaf, and given a leaf ...
Have you used the OpenAccess ORM from Telerik? How does it compare to NHibernate? When should I consider using it over NHibernate? ...
Hi, I am curious about what methods do you use for complex searching with NHibernate ? I am using Ayende's What is yours ? Thanks for your advices and answers. ...
I have a NewsFeed object mapped as such: <class name="NewsFeed"> <id name="NewsFeedId"> <generator class="guid"/> </id> <property name="FeedName" not-null="true" /> <property name="FeedURL" not-null="true" /> <property name="FeedIsPublished" not-null="true" /> </class> And Users who can have a Set of Selec...
Long title, I know but I searched all over and couldn't find that error message coming from that function call so I thought this might be more useful. This is the code snippet: string hql = " from LabRequest r where 1 = 1 "; hql += " and 0 < (select count(rs) "; hql += " from r.Statuses rs "; hql += " where rs.Stat...
Ok, so I have an object named "Business" (I know, I know, "Business Business Object") When it saved its foreign keys are getting lost somehow. Everything else is saving. I have stepped through the code and followed the object up until the session.SaveOrUpdate(businessObject); method. The object at that point is intact and the foreign ...
Hi, I have two versions of an almost identical database. Below I have created an Example table to demonstrate the basic differences, namely the ID column has changed from an Integer Identity to a GUID and various properties have been updated, in the Example archived has been replaced with readOnly and hidden: Legacy version: CREATE T...
Hi, I am using CodeSmith to Generate The Files in my Project. It has functionalities to Merge the C#/VB & SQL files using Insert Region & Preserve Region Strategies. How Can I extend these to merge the XML files I am creating?. Thanks ...
Hello, I'm using NHibernate for a project. This project opens a SQL Server 2005 database and then, after all work is done, It's supposed to backup the database. The problem is that SQL Server keeps the handle open after calling factory.Close(), so the backup copy fails. How do I close the file handle? Thanks in advance. ...
I am using NHibernate's SchemaExport to create my database schema. I have 1 legacy ref table that cannot be recreated with the Schema Export because it is already in use with other apps that use the same DB. Is there any way to map this table but tell NHibernate to skip it when running the SchemaExport? ...
Hi, I have a simple table with 6 columns. Most of the time any insert statements to it works just fine, but once in a while I'm getting a DB Timeout exception: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. The statement has been terminated. Timeout is set to 10 seconds...
In SQL one can write a query that searches for a name of a person like this: SELECT * FROM Person P WHERE P.Name LIKE N'%ike%' This query would run with unicode characters (assuming that the Name column and database were setup to handle unicode support). I have a similar query in HQL that is run by Hibernate (NHibernate). The genera...
Hi, I am using NHibernate and Rhinomocks and having trouble testing what I want. I would like to test the following repository method without hitting the database (where _session is injected into the repository as ISession): public class Repository : IRepository { (... code snipped for brevity ...) public T FindBy<T>(Expressio...
Hi, My current project connects to two separate databases almost identical in every respect except for the primary keys. Using NHibernate is it possible to map the ID to some kind of generic type? Primarily my concern is with mapping the ID to an Int64 or Guid. Recompiling the project to make the switch is not a problem, I am aware th...
How can I map to a private field with fluent NHibernate AutoPersistenceModel? public class A { private List<B> myField; public A() { myField = new List<B>(); } public IList<B> MyBs { get { return myField; } } } Is there a fieldconvention for...
Taking into consideration that NHibernate has been available for some time I thought that there would be a book available already. A search on amazon turned out just one that apparently has been delayed (Manning). Meanwhile, it looks that there seems to be coming many books on Microsoft Entity Framework. Is there any significance in tha...