tag:blogger.com,1999:blog-3717684641358442371.post6101857645313191584..comments2024-03-28T23:27:35.908-06:00Comments on Opinions and Programming: I don't like Hibernate (and Grails), PART 1Robert Peszekhttp://www.blogger.com/profile/05661893962783045407noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-3717684641358442371.post-80062030693087943772023-06-27T23:28:18.746-06:002023-06-27T23:28:18.746-06:00Thanks for sharing this useful article. python tra...Thanks for sharing this useful article. <a href="https://www.igmguru.com/data-science-bi/data-science-with-python-training-in-bangalore/" rel="nofollow">python training in Bangalore</a>Techworldhttps://www.blogger.com/profile/06313402263093153735noreply@blogger.comtag:blogger.com,1999:blog-3717684641358442371.post-11678087915047468552014-08-10T15:21:23.631-06:002014-08-10T15:21:23.631-06:00Thank you, I corrected the casing. Did not know.
...Thank you, I corrected the casing. Did not know.<br /><br />My biggest issue with unit tests is that is it easy to misuse hibernate, in many cases just adding extra query can break my code. Unit tests have no chance of uncovering these type of errors. This is my motivation for these posts: show how the code can break by making a very 'innocent' change.<br /><br />Thanks for taking time to read and comment on my post!Robert Peszekhttps://www.blogger.com/profile/05661893962783045407noreply@blogger.comtag:blogger.com,1999:blog-3717684641358442371.post-37457680945947147192014-08-03T18:30:09.105-06:002014-08-03T18:30:09.105-06:00I agree, we were auto-creating integration tests f...I agree, we were auto-creating integration tests for a while (I made that change) but reverted to unit tests when GORM was decoupled from Hibernate for NoSQL support. An in-memory GORM implementation was created then, and the new unit tests use this. But I've always advocated that you test persistence against a real database, ideally a test instance of the same db that you use in prod, but worst-case, the H2 database.<br /><br />Since only the unique constraint actually accesses the database, it's also generally fine to use unit tests for constraint tests, although I'd still tend to leave those in integration tests for consistency.<br /><br />Using GORM mocking is ok when testing controllers and services, because if you've already properly tested the domain layer, it's fine to mock out collaborators to focus on the class under test. But that should be the only use for in-memory GORM.<br /><br />btw - It's "Grails", not "GRAILS". It's not an acronym, or intentionally spelled like you're yelling. See grails.org for examples of usage.Burthttps://www.blogger.com/profile/10251282954706460100noreply@blogger.com