How do I do the following SQL in LINQ? I am actually using LINQ to NHibernate (but maybe it's not possible in NHibernate LINQ due to embedded lambda expression I think). But I want to know generally how to do it in LINQ. I’ve never came across this situation before.
SELECT c.CustomerID, c.CustomerName --etc
FROM Customers c
INN...
Hi all,
I am looking to obfuscate a data access layer which is written using NHibernate. The problem is, the mappings are done in XML files which are embedded as resources in the class library - which means the mapping are in clear text.
Two potential solutions are to use:
1. Nhibernate Mapping attributes (NHMA) to decorat ethe entitie...
Hi I have this multi-criteria, which works very well, except that I'm getting multiple of the same entities in the collections. I know this is by design, and I know you should be able to use a ResultTransformer to avoid it or filtering through a hashed set after quering.
My query looks like this:
IMultiCriteria criteria = session.Crea...
I have two tables:
SupportTicket
SupportTicketID
SupportTicketDate
SupportTicketNote
SupportTicketNoteID
SupportTicketNoteDate
SupportTicketID
With a foreign key constraint so I don't have any unassociated Notes...in sql that constraint is working properly.
On my SupportTicket class I have an IList SupportTicketNotes property...
I am looking at using an ORM in PHP for the first time. Until now my PHP projects have been fairly small and an ORM seemed like overkill.
I really like NHibernate so I was hoping that there is an ORM out there for PHP that works and is configured similarly to NHibernate. If there is one with a fluent interface like Fluent NHibernate tha...
I want to use an Object Relational Mapper (ORM) tool for my ASP.NET application. I have three options: NHibernate, LINQ to SQL, and Subsonic. Which one is fastest?
...
I want to implement NHibernate on my domain objects in my project, but I'm not sure how I should go about generating the mapping file, and the database.
I've found some questions that kind of touch on this here and here, but I'm starting with my classes already defined, and would like to start from them and work my way down, not the oth...
I am performing a standard update in nhibernate to a single property. However on commit of the transaction the sql update seems to set all fields I have mapped on the table even though they have not changed. Surely this can't be normal behaviour in Nhibernate? Am I doing something wrong? Thanks
using (var session = sessionFactory.OpenSe...
Hi,
I have entity Recipes and it has a HasMany collection comments.
In a MVC controller action I am getting the recipe
and then displaying the comments.
How do I sort the comments in descending order of "EnteredOn"?
Where do I sort them?
Recipe recipe = session.Load<Recipe>(id);
NHibernateUtil.Initialize(recipe.Comments);
Ma...
Hi,
I am using fluent nhibernate.
I have written a piece of code like,
var data = session.CreateCriteria(typeof(CustomerNameValueList))
.Add(Expression.Eq("CustomerId","3"))
.List<CustomerNameValueList>();
but the query generated by nhibernate is looks like
select column1,column2,colu...
Given a Vehicle class and a VehicleProperty class...
public class Vehicle
{
public virtual int Id { get; protected set; }
public virtual string Registration { get; set; }
private List<VehicleProperty> _properties = new List<VehicleProperty>();
public virtual IEnumerable<VehicleProperty> Properties
{
get { re...
I'm very new at this, but I need to create new tables from existing classes without creating them by hand. Can this be done using a tool or command line?
...
Let's say I have one class "User", and it "has" a property of type "Profile". How can I configure my mappings to generate the schema and create both tables in the database?
...
Hi,
Firstly anyone else trying to get onto forum.hibernate.org.
I have been trying for a while. Can't believe its down.
I am new to NHibernate. Go easy.
I have an MVC app and I have an entity called Recipe
and it has HasMany collections Comments, Ingredients
and Images.
In the action of a MVC controller I am loading the first
20 rec...
Every time i refresh the page i get the next 10 results. It is my intention to always get the same 10 items.
I have the following page
export.rails?items=10
Which hits the following Monorail Handler
public void export(int items)
{
TypedPropertyBag.Delegate = delegateRepository.FindAllDelegatesIsExported(items);
}
...
Making my first steps with NHibernate, I'm trying to have it creating my Tables automatically from the hbm files. The database backend is SQL Server 2008 Developer Edition.
This is the common sample code I see in NHibernate Tutorials:
var cfg = new Configuration();
cfg.Configure();
cfg.AddAssembly(typeof(Posting).Assembly);
new SchemaE...
I have a many-to-many relationship between photos and tags: A photo can have multiple tags and several photos can share the same tags.
I have a loop that scans the photos in a directory and then adds them to NHibernate. Some tags are added to the photos during that process, e.g. a 2009-tag when the photo is taken in 2009.
The Tag cla...
hi everyone,
I really neeed dd-mon-yy format because my oracle database accepts dates in this format.
Can I validate like that in RegularExpressionValidator like that?
And also, do I have to convert the textbox value to oracle data time format, when using nhibernate?
thanks a lot for help;
...
I have a one-to-one relationship between a Company class and a CompanySettings class. When I create a new Company object, (a CompanySettings object is created in Company's constructor for its Settings property), and then
SaveOrUpdate(session, companyObject)
I expect the INSERT to cascade from the Company to the CompanySettings. Howeve...
I am working on a new application that uses a jet (MS Access) database. I have built the database using FluentNHibernate's AutoMapping feature from my C# objects.
I need to present this database for an on-line WebEx design review on Tuesday and am looking for a tool to create ERD's for my database that I can group onto slides.
The dia...