Questions tagged [orm]

Object-relational mapping (ORM) is a technique for mapping object-oriented systems to relational databases. Use other tags to indicate the programming language ([java], [sql], [python]), database system ([postgreSQL], content management system ([django]), framework ([flask], [spring], [laravel]), application environment ([android], [node.js]), and other tags that can be used for searches and have watchers.

Object-Relational Mapping

Object-Relational Mapping (ORM) is a technique for mapping object-oriented systems to relational databases. This creates, in effect, a "virtual object database" that can be used from within the programming language. There are both free and commercial packages available that perform object-relational mapping.


Related tags

19303 questions
20 answers

What is the "N+1 selects problem" in ORM (Object-Relational Mapping)?

The "N+1 selects problem" is generally stated as a problem in Object-Relational mapping (ORM) discussions, and I understand that it has something to do with having to make a lot of database queries for something that seems simple in the object…
Lars A. Brekken
  • 24,405
  • 3
  • 25
  • 27
33 answers

How to fix the Hibernate "object references an unsaved transient instance - save the transient instance before flushing" error

I receive following error when I save the object using Hibernate object references an unsaved transient instance - save the transient instance before flushing
Tushar Ahirrao
  • 12,669
  • 17
  • 64
  • 96
18 answers

Difference between FetchType LAZY and EAGER in Java Persistence API?

What is the difference between FetchType.LAZY and FetchType.EAGER in Java Persistence API?
  • 10,085
  • 19
  • 60
  • 77
22 answers

What's the difference between JPA and Hibernate?

I understand that JPA 2 is a specification and Hibernate is a tool for ORM. Also, I understand that Hibernate has more features than JPA 2. But from a practical point of view, what really is the difference? I have experience using iBatis and now…
  • 33,838
  • 42
  • 169
  • 278
9 answers

JPA JoinColumn vs mappedBy

What is the difference between: @Entity public class Company { @OneToMany(cascade = CascadeType.ALL , fetch = FetchType.LAZY) @JoinColumn(name = "companyIdRef", referencedColumnName = "companyId") private List branches; …
  • 20,010
  • 25
  • 97
  • 140
29 answers

Infinite Recursion with Jackson JSON and Hibernate JPA issue

When trying to convert a JPA object that has a bi-directional association into JSON, I keep getting Infinite recursion (StackOverflowError) All I found is this thread which basically concludes with…
Ta Sas
  • 9,573
  • 15
  • 51
  • 73
33 answers

How to print a query string with parameter values when using Hibernate

Is it possible in Hibernate to print generated SQL queries with real values instead of question marks? How would you suggest to print queries with real values if it is not possible with Hibernate API?
  • 15,133
  • 17
  • 70
  • 86
27 answers

Conversion of a datetime2 data type to a datetime data type results out-of-range value

I've got a datatable with 5 columns, where a row is being filled with data then saved to the database via a transaction. While saving, an error is returned: The conversion of a datetime2 data type to a datetime data type resulted in an out-of-range…
  • 5,274
  • 4
  • 29
  • 34
5 answers

Hibernate show real SQL

if I set true in my hibernate.cfg.xml configuration file in the console I can see the SQL. But it's not real SQL... Can I see the SQL code that will be passed directly to database? Example: I see select…
Tommaso Taruffi
  • 8,932
  • 9
  • 44
  • 56
7 answers

What's the best strategy for unit-testing database-driven applications?

I work with a lot of web applications that are driven by databases of varying complexity on the backend. Typically, there's an ORM layer separate from the business and presentation logic. This makes unit-testing the business logic fairly…
  • 65,762
  • 16
  • 114
  • 184
16 answers

Default value in Doctrine

How do I set a default value in Doctrine 2?
Jiew Meng
  • 84,767
  • 185
  • 495
  • 805
2 answers

Laravel - Eloquent "Has", "With", "WhereHas" - What do they mean?

I've found the concept and meaning behind these methods to be a little confusing, is it possible for somebody to explain to me what the difference between has and with is, in the context of an example (if possible)?
4 answers

Which ORM should I use for Node.js and MySQL?

I'm rewriting a project to use Node.js. I'd like to keep using MySQL as the DB (even though I don't mind rewriting the schema). I'm looking for a simple-to-use, reasonable-performance ORM, which supports caching, many-to-one and many-to-many…
Near Privman
  • 3,720
  • 2
  • 16
  • 11
7 answers

Entity Framework Code First - two Foreign Keys from same table

I've just started using EF code first, so I'm a total beginner in this topic. I wanted to create relations between Teams and Matches: 1 match = 2 teams (home, guest) and result. I thought it's easy to create such a model, so I started…
  • 5,885
  • 6
  • 41
  • 55
12 answers

Using an ORM or plain SQL?

For some of the apps I've developed (then proceeded to forget about), I've been writing plain SQL, primarily for MySQL. Though I have used ORMs in python like SQLAlchemy, I didn't stick with them for long. Usually it was either the documentation…
  • 3,540
  • 3
  • 17
  • 12
2 3
99 100