Questions tagged [orm]
Object-relational mapping (ORM) is a technique for mapping between object-oriented systems and relational databases.
279 questions
1
vote
2
answers
253
views
How to Handle Data Persistence In Domain Driven Design
I am currently reading about domain-driven design and n-tier architecture with a service layer, and comparing them to try to understand how each architecture is executed.
For n-tiers (specifically 3-...
2
votes
2
answers
241
views
Best practice for ORM design (re: cascading delete from single entity)
If I have a very common shared table (ie. names) with a primary key (ie. name_id) included in many other tables as foreign keys, do I need my common table (names) to have a mapping reference to every ...
12
votes
5
answers
8k
views
Is it an anti-pattern to create ORM entities based on existing database schema?
I maintain a large legacy app working with SQL database. The app uses raw SQL queries to query the database. Together with app rewrite I plan to introduce ORM to work with the database.
The simplest ...
2
votes
1
answer
301
views
How do I structure my functions (and classes?) which interact with my Database/ORM?
So I am working on my first project using SQLite and SQLModel as ORM. Creating and handling the first table in my database was easily structured: A function for each CRUD-Operation.
But now I have ...
0
votes
3
answers
229
views
Should security and data validation be implemented within database or application?
I am building a simple web app where one set of users have varying admin privileges who can write to database and the other set can only view data.
I am used to securing APIs with JWT or session ...
0
votes
3
answers
797
views
Using orm events or database triggers
In orms, we can easily perform our desired operations in the save() method (for example, when a record is added in the likes table, the count column in the post table will increase.)
This is great, ...
1
vote
0
answers
47
views
Separating Typeorm Entities from Domain Entities [duplicate]
Is it a bad approach to add domain logic inside typeorm entities if following the domain model pattern to organize business logic.
import { Entity, PrimaryGeneratedColumn, Column } from "typeorm&...
2
votes
2
answers
2k
views
Why should I use an ORM like Entity Framework Core?
I have taken over the maintenance and development of a mature .NET Framework ASP.NET MVC application which uses an Entity Framework repository pattern. Several developers have worked on it before me ...
0
votes
1
answer
340
views
Approach for store multiple relationships POO objects in relational database
I'm developing a system in which a ClassA object can have multiple ClassB and ClassC objects.
And for store these objects in a relational DB model I create the following tables:
This is a simplified ...
0
votes
0
answers
55
views
Database-driven application. Code pattern to establish relationships
I have an application that mostly is composed of forms that create, modify, read, and deletes tables and establish relationships. I use SQLAlchemy. If, for example, I need to create an invoice and ...
2
votes
1
answer
3k
views
How to organize ORM models and business logic
I have a Python application using SQLAlchemy. It uses around 15 database tables.
For example, I have an image table that lists image files manipulated by the application. Most operations involving ...
-2
votes
1
answer
117
views
Entity objects with data external to the database
I'm looking for design patterns to model (java) objects that are partially stored in a database and partially stored some other external source. In my case the external data is a whole lot of files ...
3
votes
2
answers
1k
views
Read-only view to reference other Aggregate Roots
In his book Implementing Domain-Driven Design Vaughn Vernon suggests to reference other aggregate roots only by identity and not by reference, like this:
// Aggregate Root
class Order(
val ...
0
votes
1
answer
64
views
ORM patterns: entity properties that depend on collection loading
Given a couple of entities, Invoice and InvoiceRow, I want to calculate the total amount by summing up each row's amount.
public class Invoice
{
[Key]
public int? Id { get; set; }
public ...
2
votes
1
answer
351
views
Is it a good design to have separate Hibernate entities for general user info and user password digest?
I'm developing an app with a user management system. There is a database table named user with the following columns:
| Column Name | Column Type |
|-----------------|-------------|
| userId ...