Object-relational mapping (ORM) is a technique for mapping between object-oriented systems and relational databases.

learn more… | top users | synonyms

47
votes
14answers
3k views

Is SQL important if I know ORM frameworks well? [closed]

I don't have any serious experience in SQL and I even hate to write SQL instead of LINQ. I am happy enough with ORMs. From the employers and sector view point, is it important to know SQL? Do I have ...
31
votes
8answers
10k views

Is ORM an Anti-Pattern? [closed]

I had a very stimulating and interessting discussion with a colleague about ORM and its pros and cons. In my opinion, an ORM is useful only in the rarest cases. At least in my experience. But I don't ...
29
votes
4answers
7k views

Entity Framework with large systems - how to divide models?

I'm working with a SQL Server database with 1000+ tables, another few hundred views, and several thousand stored procedures. We are looking to start using Entity Framework for our newer projects, and ...
28
votes
6answers
12k views

Should I choose Doctrine 2 or Propel 1.5/1.6, and why? [closed]

I'd like to hear from those who have used Doctrine 2 (or later) and Propel 1.5 (or later). Most comparisons between these two object relational mappers are based on old versions -- Doctrine 1 versus ...
26
votes
13answers
8k views

What are the criteria for evaluating an ORM for.NET?

I'm looking at evaluating ORMs. I've used SubSonic, Linq-to-SQL and Entity Framework. I've got a team of developers ranging from juniors to seniors. What are the criterias for evaluating an ORM ...
23
votes
7answers
6k views

How to suggest using an ORM instead of stored procedures?

I work at a company that only uses stored procedures for all data access, which makes it very annoying to keep our local databases in sync as every commit we have to run new procs. I have used some ...
21
votes
6answers
12k views

What are some arguments AGAINST using EntityFramework? [closed]

The application I am currently building has been using Stored procedures and hand-crafted class models to represent database objects. Some people have suggested using Entity Framework and I am ...
20
votes
14answers
2k views

What are the benefits of using database abstraction by ORM? [closed]

I'm starting to use the ORM recommended by the framework I choose, and though I like the idea of the added layer of abstraction the ORM provides, I'm starting to realize what this really means. It ...
18
votes
2answers
7k views

Does it make sense to use ORM in Android development?

Does it make sense to use an ORM in Android development or is the framework optimized for a tighter coupling between the UI and the DB layer? Background: I've just started with Android development, ...
17
votes
5answers
1k views

Do ORMs enable the creation of rich domain models?

After using Hibernate on most of my projects for about 8 years, I've landed on a company that discourages its use and wants applications to only interact with the DB through stored procedures. After ...
17
votes
3answers
2k views

What are some of the benefits of a “Micro-ORM”?

I've been looking into the so-called "Micro ORMs" like Dapper and (to a lesser extent as it relies on .NET 4.0) Massive as these might be easier to implement at work than a full-blown ORM since our ...
13
votes
8answers
913 views

Should you abandon an ORM framework when you need to implement a bulk operation?

Here's a common situation: You need to implement a bulk operation in an application that uses an ORM framework. After the first pass, you've noticed significant performance problems. Here's my ...
12
votes
5answers
813 views

For an ORM supporting data validation, should constraints be enforced in the database as well?

I have always applied constraints at the database level in addition to my (ActiveRecord) models. But I've been wondering if this is really required? A little background I recently had to unit test a ...
12
votes
5answers
20k views

What are the advantages of myBatis over Hibernate? [closed]

I've done some research on my own and understand the basic concept. But some insights can only be gained through actual experience. What are the advantages of myBatis that would make it worth ...
12
votes
4answers
1k views

What would you think about a new Java persistence tool, that's not really an ORM? [closed]

Persistence in Java Over the past years, I have gathered experience in the field of persistence abstraction in Java, using concepts such as EJB 2.0, Hibernate, JPA and home-grown ones. They seemed to ...
12
votes
3answers
739 views

Does ORM promote database de-normalisation?

Doctrine and Propel both make use of single and concrete table inheritance to map object relationships. The former sees all possible fields in the class tree mapped to a single table - whereas the ...
11
votes
4answers
2k views

When to use repository pattern

I have read recently that it is not good practice to use the repository pattern in conjunction with an ORM. From my understanding this is because the abstraction they provide over the SQL database is ...
9
votes
7answers
2k views

Is Entity Framework ready for production?

I'm looking into Entity Framework for a new project that I'm going to be taking on and as part of my research into it I'm asking some industry professionals if it's stable and ready for 'real world' ...
9
votes
6answers
1k views

What kind of Web development projects benefit from using ORM?

I'll start by saying that I've done 95% of my database work using SQL. Recently, I did some investigation of various ORMs, such as NHibernate and Doctrine. I can see the advantages of not needing to ...
9
votes
2answers
506 views

Non-blocking ORM issues

I asked a question on SO, and found that there are no non-blocking ORMs for my favorite web framework. By non-blocking I mean an ORM with callback support for asynchronous retrieval. The ORM would be ...
8
votes
3answers
830 views

Creating a layer of abstraction over the ORM layer

I believe that if you have your repositories use an ORM that it's already enough abstracted from the database. However, where I am working now, someone believe that we should have a layer that ...
8
votes
5answers
5k views

When not to use ORM and prefer stored procedures?

I am using PetaPoco micro-ORM. It is indeed very easy and secure to work with databases using ORM tools, but the only thing I hate is extra code. I used to put most of the code in the database itself ...
8
votes
1answer
469 views

Do ORM POCOs replace domain entities?

This is somewhat similar to this question but more broad. In general, with ORMs like EF 4.1 supporting POCOs, does it now make sense to have your domain entities be the objects that are persisted to ...
8
votes
2answers
200 views

Best practices for serialization of DDD aggregates

According to DDD domain logic should not be polluted with technical concerns like serialization, object-relational mapping, etc. So how do you serialize or map the aggregates' state without publicly ...
8
votes
1answer
747 views

Classless tables possible with Datamapper?

I have an Item class with the following attributes: itemId,name,weight,volume,price,required_skills,required_items. Since the last two attributes are going to be multivalued, I removed them and ...
7
votes
1answer
1k views

Is inline SQL still classed as bad practice now that we have Micro ORMs?

This is a bit of an open ended question but I wanted some opinions, as I grew up in a world where inline SQL scripts were the norm, then we were all made very aware of SQL injection based issues, and ...
7
votes
3answers
159 views

How to model and store an entity which has “one or more” values

I'll use C# to design the model to be persisted Let's suppose I have the following entity: public class Episode { public int Id { get; set; } public string Title { get; set; } public ...
6
votes
3answers
4k views

DDD with ORM where should the business logic go?

I have used an MDA (model driven architecture) tool in the past where we modeled via UML and this generated the business entities (our domain model) and the ORM (mapping etc) amongst other things. A ...
6
votes
3answers
5k views

What is the best PHP ORM library? [closed]

I want to build a PHP web application, but always faces the problem that I need to connect to database and deal with related objects. So I tried codeigniter and it uses a special way to connect to ...
6
votes
1answer
2k views

Raw Sql vs SqlAlchemy when Django ORM is not enough

In a django project, if a situation comes that Django ORM is not able to execute some complex queries then there are 2 options: Use Raw Sql queries Use SqlAlchemy I want to know if there are ...
6
votes
4answers
4k views

What are some best practices for populating and using a test database?

So, I'm developing some database-driven RESTful Java web services, using Hibernate and MySQL. For testing purposes, I'm using the H2 in-memory database. H2 is nice and fast, so this has worked out ...
6
votes
4answers
535 views

What are the options when Sql generated by ORM needs tuning?

I am starting working on a web project using django. While researching whether to use Sqlalchemy or raw sql when django orm is not sufficient which is also a question I asked here Raw Sql vs ...
6
votes
4answers
383 views

Heterogeneous Associations - Data Modeling When an Object that Must Relate to One of Many Classes

Suppose you have 3 classes: ClassA, ClassB and ClassC. Now suppose you have a class Message. You want a one-to-many relationship between each one of those three classes and the Message. The goal is ...
6
votes
1answer
114 views

Data services methods naming

When you work with ORM which implement UnitOfWork pattern (NHibernate's Session, Entity Framework's ObjectContext, etc.), there are two types of data services methods: those which save/commit changes ...
6
votes
6answers
1k views

OOP Design: relationship between entity classes

I have at first sight a simple issue but can't wrap my head around on how to solve. I have an abstract class Compound. A Compound is made up of Structures. Then there is also a Container which holds 1 ...
5
votes
7answers
1k views

Best arguments for/against introducing ORM technology into a companies dev process [closed]

I have started using ORM technology in the last few years. My first exposure was NHibernate. I then moved onto Linq 2 Sql, and Entity Framework. The issue I have however is, there are some ...
5
votes
2answers
740 views

Returning an IQueryable from an IRepository

Using the Repository pattern, is it proper to return an IQueryable of a data set (table), for generic usage? It is very handy in many cases, especially when using external libraries that leverage ...
5
votes
2answers
2k views

How can I design a model layer without ORM, and when should I use it?

I'm a PHP developer who started with CodeIgniter. In it, designing models was easy: it seemed like each method defined in models was the equivalent of static methods in a normal, objected-oriented ...
5
votes
4answers
267 views

Where ORMs blur the lines between code and data, how do you decide what logic should be a stored procedure, and what should be coded?

Take the following pseudocode: CreateInvoiceAndCalculate(ItemsAndQuantities, DispatchAddress, User); And say CreateInvoice does the following: Create a new entry in an Invoices table belonging to ...
5
votes
4answers
712 views

Performance related doubt in Java with Hibernate

Suppose in some ORM based project (say Hibernate) I am trying to fetch only few columns rather then the whole Object with may be more than 20 attributes. I am writing HQL like "select attr1, attr2 ...
5
votes
3answers
620 views

Should we have a database independent SQL like query language in Django?

Note : I know we have Django ORM already that keeps things database independent and converts to the database specific SQL queries. Once things starts getting complicated it is preferred to write raw ...
5
votes
3answers
1k views

Thick models Vs. Business Logic, Where do you draw the distinction?

Today I got into a heated debate with another developer at my organization about where and how to add methods to database mapped classes. We use sqlalchemy, and a major part of the existing code base ...
5
votes
1answer
150 views

Should I Use an ORM only when dealing with Data Model objects?

I am new to ORM, and we started developing a new system using NHibernate as the ORM. I think this question may refer to any ORM and any language/platform. The Team Leader has said we should use ...
5
votes
1answer
428 views

Entity Framework as a type checking/verification system for database code

When I read pro and con lists of using Entity Framework (or any modern ORM really), I'm surprised that the following point doesn't arise (self quote): Using strongly-typed domain entities allows ...
5
votes
2answers
159 views

Database Change Auditing - Part of or Abstracted from ORM / Application Layer?

My fellow developers and I are at a crossroads in how to go about continuing our auditing of database changes. Most of our applications log changes via INSERT, UPDATE, and DELETE triggers. A few of ...
5
votes
2answers
306 views

Immutable design with an ORM: How are sessions managed?

If I were to make a site with a mutable language like C# and use NHibernate, I would normally approach sessions with the idea of making them as create only when needed and dispose at request end. ...
4
votes
4answers
1k views

When is it necessary to use ORM tools?

I was raised in a part of web developmentland where the creation of websites is mostly synonymous with Wordpress, FTP, Joomla, and procedural code, instead of things like TDD, A/B testing, Doctrine, ...
4
votes
6answers
5k views

What are the disadvantages of using stored procedures, SSIS, and SSRS to implement business applications? [closed]

Recently, it was suggested that many projects (where I work) should be implemented using some combination of stored procedures (on SQL Sever / T-SQL), SSIS, and SSRS. In one specific project, SSIS ...
4
votes
1answer
421 views

What is Rainbow (not the CMS)

I was reading this excellent blog article regarding speeding up the badge page and in the last comment the author waffles (a.k.a Sam Saffron) mentions these tools: dapper and a bunch of custom ...
4
votes
2answers
1k views

Do we achieve 100% Persistence Ignorance solution if we're not using ORM's POCO objects to model the Domain?

Persistence ignorance is ability to retrieve/persist standard objects, where standard objects are considered as classes focused on particular business problem and thus don't contain any ...