orm

Execute a "SELECT TOP n" in DB4O

Does anyone know how how to execute something like a "SELECT TOP n" in DB4O in C# ...

map raw sql to django orm.

Is there a way to simplify this working code? This code gets for an object all the different vote types, there are like 20 possible, and counts each type. I prefer not to write raw sql but use the orm. It is a little bit more tricky because I use generic foreign key in the model. def get_object_votes(self, obj): """ Get a dicti...

What is an Object-Relational Mapping Framework?

As the title says; what is a ORM framework and what is it useful for? ...

Mapping with NHibernate?

I have following classes in my domain model: public class Player { public virtual string ID { get; set; } public virtual string Name { get; set; } public virtual List<Match> Matches { get; set; } } public class Match { public virtual int ID { get; set; } public virtual Player Player1 { get; set; } public virtual...

NHibernate DuplicateMappingException when two classes have the same name but different namespaces

I have a class in my domain model root that looks like this: namespace Domain { public class Foo { ... } } I also have another class with the same name in a different namespace: namespace Domain.SubDomain { public class Foo { ... } } For my mappings, I have a Mapping directory with a subdirectory called SubDomain that contains ...

Primary Keys - Native, Sequence, or GUID keys?

In reading this and this and then reading this (which references the other two ironically) I find myself wondering just how big the discussion of this topic is? I am a SQL Server guy and so I tend to use an Identity that is auto generated in the form of an int. However, when I know that I will need some form of replication between serv...

Can't find overloaded Execute method for SchemaExport

Hi i have a problem with my first app with NHibernate like ORM in this example: http://nhforge.org/wikis/howtonh/your-first-nhibernate-based-application.aspx they use this simple test: public void Can_generate_schema() { var cfg = new Configuration(); cfg.Configure(); cfg.AddAssembly(typeof ...

Behind the scenes: How does an ORM "think"?

I'm interested in some of the design behind Rails ActiveRecord, Doctrine for PHP (and similar ORMs). How does an ORM manage to accomplish features like chained accessors and how deep are they typically expected to work? How does an ORM construct queries internally? How does an ORM manage the queries while sustaining the arbitrary natur...

A Django ORM query using a mix of filter() and Q objects.

Hi, I'm looking to create a slightly more complex query that is written fairly easily using raw SQL. Here's an example of the query in raw: SELECT my,fields FROM sales WHERE is_paid = False OR status = 'toship' AND otherfield = 'FOO' AND anotherfield = 'BAR' This is simple, it generates all the results that are is_paid = False and...

SharePoint List like Data Access Interface

Hello, I am impressed by the way we programmatically access lists in SharePoint. I percieve it as a Data Access Layer, while modeling the database is as simple as defining the columns in the List. I am looking for a tool OR an application that would give me similar interface to a database. Basically, for some reason I cannot use ShareP...

About Delphi Wings (ORM)

Someone knows if Delphi Wings (The Embarcadero ORM for Delphi) will be available in Delphi 2010? I'm testing some ORMs but I will preffer the Embarcadero one, if it's available shortly. Regards, Francis ...

Database Abstraction - what are the options?

How can I abstract my database from my application so that it is unaware of the database type? I have to design a .Net 3.5 WPF application that must support either SQL Server or Visual FoxPro as the data repository. My design goals are to: make the type of data repository invisible when writing code in the Data Access Layer make it as...

Is it posible to generate django models from the database?

I've been messing around with Django and the Django ORM at home, and I've got to say, I feel it is one of the best out there in terms of ease of use. However, I was wondering if it was possible to use it in "reverse". Basically what I would like to do is generate Django models from an existing database schema (from a project that do...

Is Python only for building backends when you need to write SQL by hand?

I am completing my first database project which aims to build a simple discussion site. The answers which I got at Superuser suggests me that Python is difficult to use in building a database webapp without any other tools. Which other tools would you use? ...

What advantage is there to overriding the == operator in an ORM?

Apparently alot of ORM's do something like this: query.filter(username == "bob") to generate sql like ... WHERE username = 'bob' Why override the == operator instead of something like: query.filter(username.eq("bob")) ...

NHibernate Conditional Mapping

Hi, I was recently hired at a Software Engineering company and was put in charge of a new project for storing our analytics data. I want to give ORM a shot the mapping doesn't seem difficult but this problem has me vexed. This database will store data for Google Analytics, Quantcast, and any future analytics provider. I was pretty much ...

Hibernate ManyToMany with Join table problems on update

Dear all, I am trying to make a ManyToMany association work for all CRUD operations I have to entities : Places and Events Places can hold multiple events and an events can take place in multiple places In first case I had In class PlaceDto @ManyToOne( targetEntity=EventDto.class, cascade = { CascadeType.PERSIST,...

Database Agnostic Reporting Frameworks

Hello, I am currently designing a .NET application using NHibernate as its DAL. I want the application to be as DB agnostic as possible and NHibernate certainly helps me achieve this. However, I know my application will need to have reporting capabilities and was wondering if there is an existing framework or set of best practices for cr...

Using NHibernate ICompositeUserType with a value type

I have a domain model object which has properties of type System.DateTimeOffset. I'm using a database which doesn't support this type natively, so I'm planning to store it using a column of type 'datetime' and one of type 'smallint'. I've dug around on how to map this using NHibernate components, and found that it could work using an I...

Convincing a die hard DBA to use an ORM for the majority of CRUD vs Stored Procedures, View, and Functions

I have been working with NHibernate, LINQ to SQL, and Entity Framework for quite some time. And while I see the benefits to using an ORM to keep the development effort moving quickly, the code simple, and the object relational impedance mismatch to a minimum, I still find it very difficult to convince a die hard SQL dba of an ORM's stre...