On Tue, Feb 6, 2018 at 9:18 AM Sanne Grinovero <sa...@hibernate.org> wrote:
> On 6 February 2018 at 14:46, Steve Ebersole <st...@hibernate.org> wrote: > > I'm not sure I would call them separate. They are clearly linked. Look at > > it this way, if we export various "validation" constraints to the > database > > (DDL) it is, practically speaking, a performance overhead to also perform > > those checks in memory. Right? This is, I think, the distinction you may > be > > missing in terms of DDL as a separate mode - only do these checks once, > at > > the database level. > > That's a grey area. Sure they are linked, as some combinations would > be nonsense, but I'd see benefits as well in being able to control > such aspects better. > > In terms of performance, it might be beneficial to abort an operation > early on ("in memory") rather than have to bother the database. It's > far easier to scale a system by adding more JVMs than to scale the > RDBMs. > > True it might be redundant if the business logic is perfect, but then > you'd not need validation. > We tend to do this argument where it "not what we would do". Well not everyone is us :) Also you are arguing about optimizing the exception case. The majority case is that the in-memory validations will (a) happen and (b) pass and then we still have the db validations happening. > Can all such validations be handled at the database level via contraints? > > No of course not - but the vast majority in fact can. > > Back in the days I've found it very useful that Hibernate ORM + > Validator + custom naming strategies, etc.. would allow me to fully > control all details of the DDL. > I used to version the DDL and have a script which gets ORM to dump it > on the same resource for each change on the model, to immediately see > the diff and understand all implications of any change on the model. > Ideal also for beginners to grow confidence in what exactly all those > annotations will do.. > Neither what Gunnar is saying nor what we do not preclude that. _______________________________________________ hibernate-dev mailing list hibernate-dev@lists.jboss.org https://lists.jboss.org/mailman/listinfo/hibernate-dev