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

learn more… | top users | synonyms

1
vote
2answers
75 views

PHP - Repository matrix pattern?

I'm trying really hard to refactor some of my legacy code in the project using best practices and design patterns + DDD so I'd love some feedback on an issue I'm currently having. Let's assume that I ...
2
votes
1answer
142 views

Persistence frameworks and common sense

I have studied some persistence frameworks mainly Hibernate, DORM, TMS Aurelius and I'm wondering. In a model of type: TOrderFiscal < > ----- > Items < > -------- > TOrderItem ...
0
votes
0answers
28 views

Doctrine 2 and Concrete table inheritance

I use Doctrine 2 and I've read some articles on inheritance strategies' mapping with ORM. I've seen three main strategies : "Class table inheritance", "Concrete table inheritance" and "Single table ...
4
votes
4answers
2k views

How to get around the Circular Reference issue with JSON and Entity

I have been experimenting with creating a website that leverages MVC with JSON for my presentation layer and Entity framework for data model/database. My Issue comes into play with serializing my ...
-2
votes
1answer
71 views

How to use ORM in MVC?

If I want to use ORM in MVC system Which is/are correct? Use ORM object to replace Model Encapsulate ORM inside the Model Use ORM outside the Model, use ORM to access DB, and then use one instance ...
0
votes
0answers
32 views

Example of persisting an inheritance relationship using ORM

I have some experience with OOP and RDBs, but very little exposure to web programming. I am trying to understand what non-trivial types of problems are solved by ORM. Of course, I am familiar with the ...
0
votes
1answer
79 views

How do you handle domain logic that spans multiple model objects in an ORM?

So I know that business logic should be placed in the model. But using an ORM it is not as clear where I should place code that handles multiple objects. E.g. let's say we have a Customer model which ...
-1
votes
4answers
1k views

Is there really Object-relational impedance mismatch?

It is always stated that it is hard to store applications objects in relational databases - the object-relational impedance mismatch - and that is why Document databases are better. However, is there ...
0
votes
1answer
233 views

Many-to-many in OOP: Class A instantiates Class B, which instantiates Class A, which

I am mapping Field1 to Field2. The map object instantiates the field object and vice versa, creating an infinite loop. This is in PHP. class field { protected $maps; // mapCollection object. all ...
0
votes
1answer
66 views

DB Design: How to link a single column to a collection of entities

I have a db design question that I am sure has been quite extensively covered but I cannot find a good answer already. The problem is how to efficiently link a single school course to a collection ...
3
votes
5answers
175 views

Is it bad software design to mix JDBC SQL calls and use an ORM in an application? [closed]

Is it bad software design to have JDBC/raw SQL and also use an ORM? I don't mind using an ORM for boilerplate CRUD, but some queries are better in SQL (for me). I'm not arguing for or against ORMs. ...
0
votes
1answer
358 views

Audit trails and entity relationships

I'm working on an order system and implementing an audit log. Two main concerns are: 1) While auditing a line item , you should only see audits for the line item 2) While auditing an order, you ...
3
votes
3answers
348 views

How does accumulating large amounts of business logic on the model objects make building strong service contracts harder?

I heard a couple of times that putting business logic in database models is bad down the road. I just read this in blog of a Rackspace employee: The Django ORM also tended to have us accumulate large ...
8
votes
5answers
15k 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 ...
-2
votes
1answer
95 views

Finding next free IP in a network

I have an IP network and want to automatically find a free IP address to provision a new server. Due to frequent server additions/removals the used IPs might be quite fragmented over the whole address ...
2
votes
1answer
213 views

What kind of object relational mapping is appropriate here?

In my database I have a table that looks like this Master(ID, Name, Attr1...). Every ID will have at least 1 entry in additional tables that have additional attributes. Those tables specialize the ...
0
votes
1answer
396 views

Android: Considering an ORM tool [duplicate]

I am developing an Android app in which I have to add chat functionality. Also, I have to save the chat history. I will accomplish this task using SQlite. But, I am not sure whether should I consider ...
11
votes
4answers
1k 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 ...
4
votes
6answers
4k 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 ...
5
votes
2answers
647 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 ...
1
vote
0answers
154 views

Benefits of using object document mapping (ODM)

I am creating a web app on Flask and was planning to use mongodb. Most of the examples using this stack that I've come across have used an ODM of some kind and was wanting to figure out whether or not ...
18
votes
6answers
10k 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 ...
0
votes
0answers
51 views

Separating Db from business with Inherited classes using multiple views

I have a software that has a car model that will be used in different views (listing, ads, detail page, carousel, up sell widget,etc). class CarModel extends DbModel{ } I look for a "nice way" (a ...
1
vote
2answers
168 views

Setter Validation can affect performance?

In a scenario where you use an ORM to map your entities to the DB and you have setter validations (nullable, date lower than today validation, etc), every time the ORM gets a result, it will pass into ...
5
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
1answer
822 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 ...
3
votes
8answers
1k views

Why are SQL databases still used with ORM?

ORMs and persistence ignorance make perfect sense: if I am programming in a language, then I want to use the language's native implementation of objects and data structures to drive my program. I ...
3
votes
1answer
144 views

ORM: Design of the service layer

I'm currently writing a medium sized web-application and find myself asking this question many times. For example, let's say there are users, which have files (one-to-many). How should the UI access ...
1
vote
1answer
68 views

When using an ORM should mappings be defined in the code file?

Doctrine offers three ways to define the object mapping properties: in XML, in YAML and as inline docblock annotations in the code. The Doctrine documentation doesn't give any advice on choosing ...
0
votes
1answer
62 views

raw aql query in framework with Active Record pattern based ORM

I use yii framework that implements Active Record pattern as ORM base. It has CActiveRecord class that is a table wrapper class with attributes reflecting table columns. So each object of this class ...
5
votes
4answers
598 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 ...
2
votes
2answers
358 views

NHibernate and complex domain model against a legacy database

I'm trying to refactor (actually, rewrite) an application which currently uses only stored procedures to access the database (hundreds of SPs). My goal is to use Nhibernate and follow a good design as ...
46
votes
14answers
2k 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 ...
1
vote
2answers
125 views

Getting related foreign keys from parent entities

I'm thinking about a design issue which affects my project's data base. Supposing there are three diferent tables: CLIENT ORDER PACKING_SLIP Each order has its client and different packing ...
15
votes
2answers
6k 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, ...
2
votes
1answer
666 views

Basic design of a data access layer using the DataMapper pattern

I'm trying to understand the DataMapper pattern by implementing it myself for one of my domain objects. So far, I have: class MyDomainObject <attributes> <business logic methods> ...
3
votes
1answer
212 views

What specific features of NHibernate cause it to be recommended for legacy database systems?

So, I've been evaluating Entity Framework and NHibernate (I'm not looking for an EF vs. NH battle here, though!). One thing that I see come up very often is that NHibernate is recommended for ...
4
votes
3answers
161 views

What is a good rule-of-thumb for naming link-tables?

In the same way that a publication table might relate to a person table via subscriptions, or a company table might relate to a person table via employee, I'm wondering if there is a descriptive way ...
1
vote
1answer
382 views

Anything beneficial from ORM for a NodeJS project already plain-SQL-implemented?

Well, actually it's a assignment project and I've already implemented a simple yet functional forum with NodeJS. But now we've been required to use ORM frameworks to refactor part of your code worth ...
6
votes
6answers
998 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 ...
0
votes
2answers
202 views

What is the convention regarding class names that may already exist in the ORM?

This is a generic question about class names and ORMs, but for context; I'm working on a Flask web app in Python using SQLalchemy. I'm struggling with naming a new class that will contain the ...
11
votes
5answers
728 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 ...
2
votes
1answer
536 views

Using a DAO to abstract our ORM from the rest of the application

We're using MySQL with Sequelize.js as the ORM. What we're wondering is whether a DOA layer of abstraction is worthwhile. Here are our options: To use the Sequelize models throughout the ...
0
votes
2answers
355 views

Mapping a legacy database to ORM using wrapper classes

I want to use an ORM with a legacy database, but I don't want to expose some of the underlying data types. For example, some of the columns are nullable doubles or floats and I want my domain model to ...
1
vote
2answers
377 views

What is the equivalent of Entity Framework in the world of Oracle shops? [closed]

Within the world of developers/firms specializing in building/deploying solutions built around software built/sold by Oracle (aka "Oracle houses"), what ORM middleware is considered as the "industry ...
22
votes
7answers
5k 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 ...
0
votes
1answer
121 views

What is a good design for a container, assignment and items

------------- 1 * -------------- * 1 -------- | Container |--------| Assignment |-----------| User | ------------- -------------- -------- ^ ...
4
votes
1answer
140 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 ...
8
votes
5answers
4k 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 ...
2
votes
1answer
189 views

Sorting rows off an autoincrementing primary key

Is it a bad practice to rely on an auto-incrementing primary key to sort rows in a table? A coworker and I were having an argument about this subject. We need to be able to find the last-inserted row ...