News for hackers. Stuff that matters.
Re:How Hibernate Almost Ruined My Career by chii on Thursday February 16, 2017 @08:11PM (#13665123)
my take on hibernate, or ORMs in general, is really to abstract the _differences_ between vendors' sql implementation (including creation, and upgrading of schema). If you have to ship a product that have to work under all database vendors, an ORM like hibernate is the only choice - otherwise, you'd have to write separate scripts for each vendor, and that just makes the job at least 5x harder (or more, assuming you go for more vendors).

Not kwowing how to write proper SQL is a problem, and ORM won't solve that for you.

Re:How Hibernate Almost Ruined My Career by guelo on Thursday February 16, 2017 @08:16PM (#13665137)
Doesn't seem like that common of a problem to have to ship code that has to work with different databases. But if I ever had to do such a thing I would just stick with ANSI SQL.
Re:How Hibernate Almost Ruined My Career by koolba on Thursday February 16, 2017 @08:22PM (#13665163)
There's no such thing as ANSI SQL for real world applications on real world databases. Even something as simple as limiting the number of rows returned varies widely (TOP vs LIMIT vs rownum).

The correct answer is to forget about database independence and double down on just one[1] so you can use it to its full potential.

[1]: And obviously it should be Postgres...

Re:How Hibernate Almost Ruined My Career by xxs on Thursday February 16, 2017 @08:46PM (#13665269)
and you missed "fetch first" which is the ANSI thing
Re:How Hibernate Almost Ruined My Career by chii on Thursday February 16, 2017 @08:49PM (#13665283)
> common of a problem to have to ship code that has to work with different database

when you are not writing a SaaS, but shipping a piece of software for a customer to run on their own server, it's a very common use case to support different database vendors - especially in enterprise software.

Re:How Hibernate Almost Ruined My Career by flukus on Friday February 17, 2017 @12:19AM (#13666128)
Generally the database to use is dictated by the software, that or it will support one or two, not any database.
Re:How Hibernate Almost Ruined My Career by akud on Thursday February 16, 2017 @09:13PM (#13665399)
It's useful to, for instance, run your test suite against an in-memory database like sqlite or hsql, but use a "real" database in production.
Re:How Hibernate Almost Ruined My Career by RussianCow on Thursday February 16, 2017 @09:25PM (#13665459)
I think using VMs or something like Vagrant is a much better solution to that problem. You generally don't want to test against something that's drastically different than what you run in production.
Re:How Hibernate Almost Ruined My Career by paulddraper on Thursday February 16, 2017 @09:38PM (#13665523)
If at all possible, you should choose one DBMS and stick with it.

There are non-abstractable differences once you no longer have a toy project, e.g. locking and isolation semantics.

There might be some valid reason for making your applications talk to different DBMS, but you have a tough slog ahead no matter how you do it.

Re:How Hibernate Almost Ruined My Career by Daishiman on Friday February 17, 2017 @02:01AM (#13666489)
> If at all possible, you should choose one DBMS and stick with it.

Yeah, sure, go tell that to your manager who promised multi vendor compat to your clients.

Problems with the ORM nowadays always stem from developers who are ignorant of SQL. Those people should not be working for you anyway.

Re:How Hibernate Almost Ruined My Career by paulddraper on Friday February 17, 2017 @09:15AM (#13668339)
> go tell that to your manager who promised multi vendor compat to your clients

Okay, I'll tell him that 5x the systems means more work, possible bugs, etc. Seems logical.

I'll tell him the same thing if he promises Windows, Mac, Linux, Solaris, and Plan 9 compatibility.

I'm not saying you shouldn't be able to use the same application with several databases; I'm saying you should avoid it.

Re:How Hibernate Almost Ruined My Career by jwatte on Friday February 17, 2017 @12:16AM (#13666116)
Why don't you write your code so you don't have to choose a compiler vendor or runtime? Java today, Rust tomorrow!