Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [orm]

Object-relational mapping is a programming technique that allows applications to work with the data as objects, but store the data in a database as groups of simpler values.

1
vote
0answers
26 views

Weird MySQL column name issue

After trying to use the Propel PHP ORM on my database, I noticed that there is an issue with foreign keys. This is a table with foreign keys: CREATE TABLE `appusers` ( `AppID` INT(11) NOT NULL, `...
1
vote
0answers
66 views

help in designing a database for medical clinic keeping record of patient visit

I am making software for patients record keeping in a clinic . I have written a peewee model for setting up tables to store record of each patient visit and patient contact and a relative table that ...
-1
votes
2answers
69 views

Is there a non-syntactical guide for naming database columns? [closed]

Is there a guide or best case practise to help people on choosing the best database column names. I am not looking at syntactical naming conventions such as snake case, camel case or even singular or ...
2
votes
1answer
41 views

DB design to avoid versioning inconsistencies between the application layer and the database layer

Usually there is a 1-1 mapping between an object in the application layer and a table in the database layer. This coupling leads to complexities whenever there is a database schema change and the ...
0
votes
1answer
52 views

What and where to index, rapid increasing table postgres

I work as a software engineer with python and django. Currently I am struggling with a design choice made before my time. We have a transaction table that logs all customer activity. Due to the ...
0
votes
1answer
2k views

How to set a auto-increment value in SQLAlchemy?

This is my code : class csvimportt(Base): __tablename__ = 'csvimportt' #id = Column(INTEGER, primary_key=True, autoincrement=True) aid = Column(INTEGER(unsigned=True, zerofill=...
1
vote
1answer
53 views

Can i make a relationship between two relationships in the database?

I am making a database system where there are patients, doctors, categories and medical records. doctor and patient has a relationship called treatments ( many-to-many ) patient and a relationship ...
0
votes
0answers
37 views

I have a model of a table, and would like to keep database in sync, what is best method?

The model is an ordered (using additional array) hash table, with keys being columns' names, and values being columns' types. To visualize in an abstract programming language: MyHashTable[2] = ( "...
6
votes
3answers
506 views

How to model Parent -> Child -> Grandchild if the Child can be removed

I'm dealing with a set of relationships where the child can be removed, but I obviously don't want to lose the connection between the grandchild and the parent. I did think about marking the child as "...
0
votes
1answer
129 views

MySQL table not working after a few days of use

I have the following tables on MySQL server, 5.5.46: CREATE TABLE `locking` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `filename` varchar(255) NOT NULL, `timestamp` timestamp NULL DEFAULT ...
0
votes
0answers
45 views

How to handle frequently outdated statistics dealing with an ORM?

We have a vendor application that uses Hibernate ORM (an object-relational mapping tool). It routinely generates queries returning hundreds of columns out of 10+ tables at a time. By logging the ...
1
vote
3answers
257 views

How can I optimize a query where a IN clause is replaced with multiples UNION ALL?

I have a query like this: select * from slow_view where id = 1 union all .... union all select * from slow_view where id = 1000 -- 50 ids, exec time: 10.615 sec, This would run in a very ...
16
votes
2answers
5k views

What's the overhead of updating all columns, even the ones that haven't changed [closed]

When it comes to updating a row, many ORM tools issue an UPDATE statement that sets every column associated to that particular entity. The advantage is that you can easily batch the update ...
2
votes
1answer
78 views

Do ORMs provide interfaces for working with window functions?

Many of my friends as well as previous workplaces emphasized use of ORMs over working with SQL directly. I've been exposed to Laravals ORM (Eloquent), Silverstripe's ORM, Active record, and Entity ...
0
votes
4answers
90 views

Design Pattern to Reduce Number Of Columns

I have a table with 49 columns, which is already normalized. It seems kind of excessive, but since every field is part of a form and the main entity is the form there are no relations I can refactor ...
1
vote
1answer
55 views

Scalability assessment for a simple auditing system based on an ORM

I was asked to create a simple audit system for a Web application. Due to some constraints I have chosen a "dirt and quick" way. This was possible due to small activity in that particular application (...
1
vote
0answers
316 views

Performance of an index on a column which is always null

I'm using a custom ORM framework which creates a column for all tables in the database called 'owningObject'. The column is a varchar(255) and the value is always NULL. The ORM is also creating an ...
1
vote
1answer
91 views

Avoiding foreign key repetition on related tables in a relational DB

I have a simple DB schema describing certain objects that belong to a historical time period of a country and (optionally) a subdivision of that country at that period. The contrived UML class diagram ...
1
vote
0answers
45 views

Trying to understand if annotations are necessary or not in ORMs

My previous thread was here https://softwareengineering.stackexchange.com/questions/328793/can-anyone-explain-this-one-to-one-one-to-many-many-to-one-many-to-many-conce but honestly I think it ...
2
votes
1answer
5k views

Join second table based on third table with conditions

I"m using Doctrine for a website that has 3 tables to connect together. In simplest terms, they look like this Contractor - id - name ContractorJob - id - contractor_id - job_id - status Job - id - ...
0
votes
1answer
90 views

SQL to DjangoORM query

I've model, class ModelA(models.Model): device_id = models.IntegerField() deal_sent = ArrayField(models.IntegerField) For given device_id, we can have a list of repeating deal_sent. For eg:- ...
0
votes
1answer
49 views

Consultants using old version of Hibernate ORM for new application - should I be concerned?

My company currently has consultants developing a Java-based application. They are using Hibernate ORM 3.5 (released 5 1/2 years ago in 2010) in this application. The back-end is SQL Server 2012. ...
2
votes
1answer
681 views

HQL pagination returns same result on different pages - with SQL

We have the following query in the server (using sql): Query query = this.entityManager.createQuery( "SELECT type, id, date, amount FROM Transaction ORDER BY type ASC"); The type field is ...
0
votes
1answer
87 views

Updating inverse side bidirectional association

I understand (more or less) the concept of unidirectional and bidirectional association in a relationship, but I don't see the correct practical application of it. For example, I want an contact ...
1
vote
0answers
78 views

Type of relational/object-oriented database with improved joins for object graphs?

I would like to know if there is a specific name or term for the kind of database described below: I notice one of the biggest problems when working with relational databases and object trees/graphs ...
0
votes
0answers
1k views

Deadlocks due to foreign keys (MySQL)

We are in the process of creating a web application using mysql as a data source. We are using spring with hibernate as an ORM framework. We have hundreds of entities with relations (manyToMany \ ...
4
votes
2answers
3k views

Lower() vs ilike on postgresql

What I want to do is to check if value of column equals some string, but case insensitive. Is there a performance difference when using ilike without wildcards (percents) and lower() ? I was planning ...
5
votes
3answers
1k views

Replace relational database with “poor” design in software product with non-relational DB? [closed]

Edit: This question is about how to deal with many issues that arose from a overall system design, which made parts of the system deviate from common standards. For example, managing everything in the ...
2
votes
2answers
86 views

Do I need foreign keys in ORMs?

Object Relational Mapping (take ActiveRecord and Rails, for example) allows a programmer to define relations between models, and callbacks on delete. So my question is: do I still need to define ...
4
votes
1answer
531 views

The future of DBAs with ORM [closed]

I am an aspiring DBA (I'd say in ~3 years I would be ready to apply for a job) and I currently am a programmer. I relayed my future goals to a friend of mine who is part of an Agile SCRUM team in a ...
1
vote
1answer
52 views

Effectively modelling extended classes

I have 3 different types of content for a website, 'Article', 'Video', 'Review'. Each of those three types of content contain common fields and type specific fields. For this, I have created the ...
0
votes
1answer
161 views

Nullable One To Many w/Join Table - Indexing

I have a question regarding database design, I am working with PostgreSQL using Hibernate for ORM, the design I inherited includes the following tables users user_id (pk) user_name user_dob ... ...
2
votes
1answer
1k views

Multi-variance products

My current system houses different variants of Products in different tables; Productgroups Productcolors Productsizes Productmodels Products can reside under 1 Productgroup and can have multi-...
5
votes
2answers
2k views

What are the advantages of a database design with single table for MtM relationships?

The database that backs our software product has a table design like the following: Positions ID Name Parts 1 One 12345 2 Two 12346 3 Three 12347 Collections ID ...
2
votes
1answer
3k views

Java application unable to access Blob stream in Oracle after upgrade to 11g

This issue below might be an application problem, but I cannot seem to rule out a poor database setup, I was hoping to get some insights into potential database issues. I am maintaining a legacy Java ...
6
votes
4answers
497 views

How to troubleshoot orm queries interfering with other applications

Well, it's hypothetical scenario but what I'm trying to understand is the path to go from a post-morten log (say, an SQL Server Profiler trace) to identify the code on a ORM situation. To make it not ...
-1
votes
1answer
2k views

Difference in between HAS MANY and BELONGS TO in Yii framework [closed]

I am new to the Yii Framework. I discovered HAS MANY and BELONGS TO in the documentation, however I am confused about these features. Can someone give some real life examples with a diagram that ...
4
votes
3answers
1k views

How does NHibernate handle execution plan?

I heard from a podcast that there are no ORMs that have a good solution for execution plan reuse. It will lead to increased execution plan cache which affects the performance. How does NHibernate ...
6
votes
3answers
2k views

Is the ADO.NET Entity Framework known for generating poorly performing queries?

This question is inspired by the comment posted to the latest ServerFault blog post: Are you guys still using LINQ to SQL? I know I can use SQL Server Profiler and/or the ToTraceString method to ...
6
votes
4answers
7k views

Why does this Entity Framework query perform so bad in MySQL?

Let me give you a little setup. We have a InnoDB table on MySQL 5.1 with close to 20 million records, no foreign keys, and proper indexes for queries we do. We are using the latest 6.3.5 MySQL ...
19
votes
4answers
1k views

When using an ORM, what are some things to watch out for in your database design

What are some database design gotchas to watch out for when you know the database will be accessed using a Object Relational Mapper (ORM) Wikipedia? Also see Entity Framework NHibernate or LLBLGenPro. ...