DEV Community

Discussion on: When to use/not use an ORM

Collapse
 
petros0 profile image
Petros Stergioulas • Edited

I was also struggling with that question.

I feel like for simple crud an orm is great and it doesn't add overhead.

If you complex relations and joins etc, maybe you should write the queries.

Collapse
 
rumeshmadhusanka profile image
Rumesh Madhusanka

For complex tasks, functions and procedures are handy. But ORMs build the database from scratch. Do ORMs allow functions, procedures..? 🤔

Collapse
 
petros0 profile image
Petros Stergioulas • Edited

I think yes. In some frameworks you can call a Procedure e.g. as a method with parameters and an output and then call it.

For example in java with spring-data-jpa (compination of Hibernate and Jpa) you can do something like this:

@Procedure(procedureName = "PROCEDURE_NAME")
boolean method0(@Param("param0") int param0);

source: logicbig.com/tutorials/spring-fram...

Also, I do not think it's wise to let ORM to build up your database (at least your production db). To build up a database, try better a migration tool.