You can mock the JDBC driver and test the emitted SQL from there; I am using mockrunner-jdbc [1] to do that. Since Hibernate needs to chat with DB a bit before doing the logic of that test, it's convenient to switch between real DB and the mocks at runtime. I've created a little tool [2] to do that - actually this disables recording of executed statements (since I am using this for performance testing rather than behaviour verification), but it's trivial to revert that ([3] - just use default ctor).
Radim [1] https://github.com/mockrunner/mockrunner [2] https://github.com/rvansa/perfmock [3] https://github.com/rvansa/perfmock/blob/master/src/main/java/org/perfmock/PerfMockDriver.java#L179 On 11/01/2015 11:01 PM, Sanne Grinovero wrote: > Adding back the list. > > To answer Martijn: personally I don't know the answer, but it sounds > like an excellent idea to implement that, if it's not possible > already. > Keep in mind that Hibernate might need to generate multiple SQL > statements per operation. > > Sanne > > ---------- Forwarded message ---------- > From: Martijn Dashorst <martijn.dasho...@gmail.com> > Date: 31 October 2015 at 05:43 > Subject: Re: [hibernate-dev] Link to test case templates > To: Sanne Grinovero <sa...@hibernate.org> > > > Good to see making test cases easier. > > Is it possible to test the actual SQL that is emitted by Hibernate > from a test case? I've looked at the github repo but didn't find a > matching method. > > Martijn > > On Friday, 30 October 2015, Sanne Grinovero <sa...@hibernate.org> wrote: >> We should add a page on hibernate.org describing the idea, and from >> there point to github. >> >> On 30 October 2015 at 07:49, Steve Ebersole <st...@hibernate.org> wrote: >>> But that was not the purpose of the content at the old link. Yes the >>> templates are nice but that's not the whole picture of what makes a good >>> test case >>> >>> On Fri, Oct 30, 2015, 9:41 AM Gunnar Morling <gun...@hibernate.org> wrote: >>> >>>> 2015-10-30 15:16 GMT+01:00 Steve Ebersole <st...@hibernate.org>: >>>>> It looks like that may just be an invalid URL. >>>> Yes, the link should point to >>>> https://github.com/hibernate/hibernate-test-case-templates instead. >>>> There are the test case templates and also a description of their >>>> usage. >>>> >>>> >>>>> It looks like the content >>>>> that was at that URL was not migrated over in the website migration. >>>>> >>>>> This ties in with an uneasiness that has been growing on me tbh... We >>>> have >>>>> too many places users have to look for potential information. The >>>> website, >>>>> the JBoss wiki, the GitHub wiki, README.mds, CONTRIBUTING.mds. It's >>>> hard to >>>>> keep straight :) >>>>> >>>>> Ideally a lot of this would live under hibernate.org website umbrella. >>>> But >>>>> to be frank, I find developing content for hibernate.org and >>>> in.relation.to >>>>> to be cumbersome. We can get into "why" in a separate subject. >>>>> >>>>> >>>>> >>>>> On Fri, Oct 30, 2015 at 8:53 AM Steve Ebersole <st...@hibernate.org> >>>> wrote: >>>>>> But for some reason it directs me back to JIra. Even just clicking that >>>>>> link in the email does. I wonder if someone set up a bad redirect on >>>> the >>>>>> hibernate.org website for that? >>>>>> >>>>>> On Fri, Oct 30, 2015 at 8:52 AM Steve Ebersole <st...@hibernate.org> >>>>>> wrote: >>>>>>> The link target is >>>> http://www.hibernate.org/issuetracker.html#testcases. >>>>>>> That's not the "JIRA main page". >>>>>>> >>>>>>> >>>>>>> On Fri, Oct 30, 2015 at 8:44 AM Gunnar Morling <gun...@hibernate.org> >>>>>>> wrote: >>>>>>>> Hi, >>>>>>>> >>>>>>>> When creating a new HHH issue, there is a link "...should generally be >>>>>>>> accompanied by a test case" but it directs to the JIRA main page. >>>>>>>> >>>>>>>> Can we let it point to the test case template repo instead: >>>>>>>> >>>>>>>> https://github.com/hibernate/hibernate-test-case-templates >>>>>>>> >>>>>>>> Thanks, >>>>>>>> >>>>>>>> --Gunnar >>>>>>>> _______________________________________________ >>>>>>>> hibernate-dev mailing list >>>>>>>> hibernate-dev@lists.jboss.org >>>>>>>> https://lists.jboss.org/mailman/listinfo/hibernate-dev >>> _______________________________________________ >>> hibernate-dev mailing list >>> hibernate-dev@lists.jboss.org >>> https://lists.jboss.org/mailman/listinfo/hibernate-dev >> _______________________________________________ >> hibernate-dev mailing list >> hibernate-dev@lists.jboss.org >> https://lists.jboss.org/mailman/listinfo/hibernate-dev > > > -- > Become a Wicket expert, learn from the best: http://wicketinaction.com > _______________________________________________ > hibernate-dev mailing list > hibernate-dev@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/hibernate-dev -- Radim Vansa <rva...@redhat.com> JBoss Performance Team _______________________________________________ hibernate-dev mailing list hibernate-dev@lists.jboss.org https://lists.jboss.org/mailman/listinfo/hibernate-dev