![]() ![]() It's kind of old good jdbc query style (which I personally really like). It might be more performant than hibernate and it has no magic like spring data. If at the very beggining you have no idea which database would be used or you know for certain that migration is possible than - jooq is good option. BUT if you had an idea to write your own generation sql builder engine - DONT DO IT! Do not reinvent a wheel. Just trust me - many teams refused to use it after some iterations. Paid version is much more rich.Īctually generation disadvantage makes JOOQ almost forbidden as far as generation bring to much problems by many reasons and I'm too lazy to count them. ![]() Free version is limited by 9 databases, so I do believe that you would need more than mysql/postgres/h2.Everytime you change your database/schema you need to execute annoyoing stage with classes generation. Only two key advantages give you huge possibilites to write quick pseudo jdbc queries and be able to migrate from one database to another. Jpa enitity generator (but that part is outside of the article).Write universal query compatible with 9 databases in free version (including mysql,postgresql) and more 30 databases in paid version.Comlile time safe query - even before compilation your query is correct, meanwhile in first example you can easily make mistake eg - extra comma etc.We can use jooq to generate USERS java class and build next query: Record userRecord = jooqContext. JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource) For example instead of next text query: String sql = " SELECT * FROM USERS WHERE ID = 33 " Shortly JOOQ is framework allows you to construct sql queries in java (by generating java enitites from database schema). ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |