java - Hibernate - Extract parameter values from SQL query -


I have a class that populates the Hibernate SQL query parameter with different values ​​depending on some input criteria. is. I would like to write the test for the resulting query. As of now, I have not found a way to get a parameter value that was set to the query. I saw the resulting query implementation (in this case, SQLQueryImpl) and there is a method called GetParameterMetadata (), as if something can give me, but I can not find anything.

I want to be able to do something like this:

  assertEquals ("some value", query.getParameterValue (parameterName));  

Is there any way to do this?

Edit:

I just saw a little more, and give me a

  query.getQueryParameters (map) .getNamedParameters ()  

Which gives a map I believe that the map contains parameters and their value. I correct me if I am wrong.

In fact, I did not consider this fact because I tested, I could just duplicate the query I can expect specific criteria.


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -