hibernate-reactive icon indicating copy to clipboard operation
hibernate-reactive copied to clipboard

Check that we actually run the custom queries in CustomStoredProcedureSqlTest

Open DavideD opened this issue 2 years ago • 4 comments
trafficstars

In CustomStoredProcedureSqlTest, we use custom queries with stored procedures to test the support for the annotation @SqlInsert, @SqlUpdate, and @SqlDelete.

It works fine, but we are not actually checking that we are running the custom queries for the CRUD operations.

We usually check the log using our custom SqlStatementTracker class

DavideD avatar Jun 16 '23 09:06 DavideD

Hi, I want to examine this issue. Please assign me. And Would I get some more information about the issue? @DavideD

Nesrinasan avatar Jun 27 '23 20:06 Nesrinasan

Hi, the assertions in this test check the values in the entities.

But I would also like to add some assertions on the generated SQL, and make sure that we are running the SQL specified by the annotations. For example, for the insert, we should see in the log SELECT PROC_INSERT_RECORD( $1, $2 );, instead of INSERT INTO ....

An existing test that does something similar is OrderQueriesTestBase.

We already know that this feature works, so we only need to add the new assertions to the existing ones.

I haven't added a contribution guide for this project yet, but you can find the templates for the code on the hibernate/hibernate-ide-templates (the hibernate_orm ones). And start the commit message with the issue code, please. For example: [#1673] Check the generated SQL in CustomStoreProcedureSQLTest .

Thanks a lot, and feel free to ask more questions.

DavideD avatar Jun 28 '23 07:06 DavideD

Hi Davide. I started to write the test. while I write test, I am using @SqlInsert, @SqlUpdate, and @SqlDelete. for example: I will use these annotations(@SqlInsert, @SqlUpdate, and @SqlDelete. ) while writing the insert, delete, update test between one-to-one related tables.

Did I understand correctly? @DavideD

Nesrinasan avatar Jul 05 '23 10:07 Nesrinasan

Sounds correct.

What I had in mind was to add some assertions in the existing CustomStoredProcedureSqlTest, but creating a new class is fine as well, if you prefer.

DavideD avatar Jul 05 '23 11:07 DavideD