Why do we need to write a native sql query in a hbm.xml rather than in a string of java file?



Lets say for example I have the following query (simple one but I know we use native sql queries only when we have complex ones which cannot be written as named queries)



String query = "select top 1 id from comp_job_processing_cycle order by start_date desc"


Now I was told that we are supposed to write these native sql queries in somefile.hbm.xml file rather than the way I have written in a java file. Why is that?


No comments:

Post a Comment