7

To all the people who complain about writing a delete or update query. Not to talk you down, but seriously. STOP WRITING RAW QUERIES AND USE AN ORM!

Comments
  • 1
    @h3ll the hate on orm is unjustified , i know it's not an all round solution, but when fit it can save a ton of time
  • 1
    also to OP, why the fuck edit a live db instead of writing migrations ?
  • 1
    when i think orm i think of rails active record, rarely of doctrine, anyway if you're using an orm of complex queries you're doing it wrong
  • 2
    Heed the advice, no point in writing queries unless you're micro optimising and you're a some kind of DBA with a death wish. As a mortal programmer, don't touch the goddamn SQL and leave it for maintenance or pros.

    And please use a sane Orm like active record, if you're still into hibernate is time to give your pension account a last couple of loving pats and cash out.
  • 3
    First...

    A possible solution is not an cure for everything - ORMs allow direct access to the database,so u can write raw sql and even update queries which then bypass the ORM.

    Second...

    Mistakes happen. There is a reason why backups exist. Not only for data recovery, but if u are afraid of an update query, take a backup, create an database with the same configuration, run and observe...
    Problem solved.

    Third...
    For fucks sake stop proposing solutions like a moron - ORMs can make sense and can scale, as most of the time the ORM is the lesser problem, it is the dev who does not give fucks about database query and table design.

    Best example is the still widespread usage of active row pattern and friends and people who translate n + 1 query problem with ORM without seeing that there is an fundamental difference between tool, implementation and usage.
  • 1
    @IntrusionCM you forgot the editing a live production database part of this moron fuckery
  • 1
    Not sure if I understand what u mean, but there is nothing wrong at all with editing a production database....

    As long as u don't do it without preparation and a plan.

    Otherwise, yes. Dumb idea. Very dumb.
  • 3
    An interesting read if you get the time: Object-Relational Mapping is the Vietnam of Computer Science

    https://blog.codinghorror.com/objec...
  • 0
    @rusty-hacker thats actually a pretty good read. I guess my answer was a bit too arrogant. Thanks!
Add Comment