{"id":541248,"date":"2025-01-29T16:41:10","date_gmt":"2025-01-29T15:41:10","guid":{"rendered":"https:\/\/blog.jetbrains.com\/?post_type=idea&#038;p=541248"},"modified":"2025-12-08T16:04:51","modified_gmt":"2025-12-08T15:04:51","slug":"tips-for-productive-java-development-with-databases-in-intellij-idea","status":"publish","type":"idea","link":"https:\/\/blog.jetbrains.com\/pt-br\/idea\/2025\/01\/tips-for-productive-java-development-with-databases-in-intellij-idea","title":{"rendered":"9 Tips for Productive Java Development With Databases in IntelliJ IDEA"},"content":{"rendered":"\n<p>In this article, we\u2019ll share nine time-saving ways IntelliJ IDEA can boost your productivity when developing Java applications with databases \u2013 whether you&#8217;re starting a new project or diving into an ongoing one.<\/p>\n\n\n\n<p align=\"center\"><a class=\"jb-download-button\" href=\"https:\/\/jb.gg\/button-idea-download\" target=\"_blank\" rel=\"noopener\">Get IntelliJ IDEA<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Create data sources automatically from properties<\/h2>\n\n\n\n<p>IntelliJ IDEA makes it easy to create a data source for your Spring project right from the <code>application.properties<\/code> file \u2013 simply open it and click on a gutter icon next to the properties.&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" loading=\"lazy\" width=\"1500\" height=\"600\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2025\/01\/datasource-create-min.png\" alt=\"\" class=\"wp-image-541298\" style=\"aspect-ratio:2.5;width:802px;height:auto\"\/><\/figure>\n\n\n\n<p>In the opened <em>Data Sources and Drivers<\/em> dialog, you\u2019ll see a data source already assigned and the database-related fields prefilled \u2013 all you need to do is to test connectivity (just in case) and click <em>OK.<\/em> The data source will be created for you.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Test Spring Data JPA query methods without running the application<\/h2>\n\n\n\n<p>IntelliJ IDEA simplifies Spring Data JPA method query verification! It provides autocompletion for names and the ability to check generated queries without running the application. Just click the dedicated gutter icon to execute repository methods directly in the JPQL console.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" loading=\"lazy\" width=\"1500\" height=\"950\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2025\/01\/jpql-console-gutter-min.gif\" alt=\"\" class=\"wp-image-541309\" style=\"aspect-ratio:1.5789473684210527;width:803px;height:auto\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Review database schemas as diagrams<\/h2>\n\n\n\n<p>Database diagrams are great for quickly grasping the structure of databases and understanding the relationships between their various objects. IntelliJ IDEA can create detailed diagrams for data sources, schemas, or tables to help you analyze the data structure more effectively. To generate a diagram, right-click a database object in the <em>Database <\/em>tool window and select <em>Diagrams | Show Diagram<\/em>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" loading=\"lazy\" width=\"1500\" height=\"600\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2025\/01\/db-diagram-review-min.gif\" alt=\"\" class=\"wp-image-541646\" style=\"aspect-ratio:2.5;width:802px;height:auto\"\/><\/figure>\n\n\n\n<p>You can also assign colors to diagram objects to further enhance the way you interact with and&nbsp;comprehend your database structure.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" loading=\"lazy\" width=\"1500\" height=\"600\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2025\/01\/duagram-color-min.png\" alt=\"\" class=\"wp-image-541320\" style=\"aspect-ratio:2.5;width:802px;height:auto\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Review query results right in the editor<\/h2>\n\n\n\n<p>IntelliJ IDEA provides a compact way to review query results right in the editor. To enable it, click the <em>In-Editor Results<\/em> button in the query console before running your query. \u200b\u200bThis is especially useful for working with smaller datasets or data samples.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" loading=\"lazy\" width=\"1500\" height=\"600\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2025\/01\/query-in-editor-min.png\" alt=\"\" class=\"wp-image-541332\" style=\"aspect-ratio:2.5;width:801px;height:auto\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Modify query data in the results set view<\/h2>\n\n\n\n<p>When you need to make changes to cell values in IntelliJ IDEA, you don\u2019t have to write and re-run queries! Simply click on a cell value that you want to edit, enter the new value, then click the <em>Submit<\/em> button (\u2b06) or <em>\u2318\u21a9\/Ctrl+Enter<\/em> to push changes to the database.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" loading=\"lazy\" width=\"1500\" height=\"950\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2025\/01\/results-view-fin-min.png\" alt=\"\" class=\"wp-image-541657\" style=\"aspect-ratio:1.5789473684210527;width:802px;height:auto\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">View query results as charts<\/h2>\n\n\n\n<p>Charts provide a powerful and user-friendly way to quickly gain actionable insights from your query results. This feature is particularly useful when analyzing large datasets, looking for patterns, or presenting trends in an easily comprehensible format.<\/p>\n\n\n\n<p>To open chart settings, click the <em>Switch to Chart<\/em> icon on the data editor toolbar. You can choose from a wide range of chart types, including bar charts, pie charts, area charts, line charts, and more, depending on what best suits your needs.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" loading=\"lazy\" width=\"1624\" height=\"650\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2025\/01\/db-charts-min.gif\" alt=\"\" class=\"wp-image-541343\" style=\"aspect-ratio:2.4984615384615383;width:801px;height:auto\"\/><\/figure>\n\n\n\n<p>When you need to present your findings or keep snapshots of data dynamics, you can export charts in <code>.png<\/code> format. To save a chart snapshot, simply click the <em>Export to PNG<\/em> button in <em>Series<\/em> <em>Settings<\/em>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" loading=\"lazy\" width=\"1500\" height=\"600\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2025\/01\/save-chart-min.png\" alt=\"\" class=\"wp-image-541354\" style=\"aspect-ratio:2.5;width:800px;height:auto\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Profile your query with an execution plan<\/h2>\n\n\n\n<p>You can also visualize execution plans for queries, illustrating the set of steps that were used to access data in a database and the cost of each step \u2013 in other words, how long it takes to run the statement.&nbsp;<\/p>\n\n\n\n<p>To open the execution plan, right-click an SQL statement, select <em>Explain Plan | Explain Plan<\/em>, and then click on the <em>Show Diagram<\/em> icon.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" loading=\"lazy\" width=\"1500\" height=\"950\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2025\/01\/query-execution-plan-min.png\" alt=\"\" class=\"wp-image-541365\" style=\"aspect-ratio:1.5789473684210527;width:801px;height:auto\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Use DB migration libraries to update application databases<\/h2>\n\n\n\n<p>Database schemas evolve over time as business requirements change, and database schema updates and migration can be tricky and error-prone when done manually. Instead, take advantage of IntelliJ IDEA&#8217;s built-in support for automatically generating migration scripts based on existing JPA entities. For more information, refer to <a href=\"https:\/\/blog.jetbrains.com\/idea\/2024\/11\/how-to-use-flyway-for-database-migrations-in-spring-boot-applications\/#7.-generating-flyway-migrations-using-intellij-idea\">this article<\/a>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" loading=\"lazy\" width=\"779\" height=\"383\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2025\/01\/flyway-migration.png\" alt=\"\" class=\"wp-image-541768\" style=\"aspect-ratio:2.033942558746736;width:706px;height:auto\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Leverage AI Assistant<\/h2>\n\n\n\n<p>AI Assistant makes data query and managing data <a href=\"https:\/\/blog.jetbrains.com\/idea\/2024\/10\/streamline-workflow-in-database-tools-with-ai-assistant\/\">faster and more efficient<\/a>. It helps speed up SQL query generation, provides explanations, suggests fixes, and can even generate test data tables!<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" loading=\"lazy\" width=\"1500\" height=\"600\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2024\/10\/ai-prompts.png\" alt=\"AI Actions for SQL query in IntelliJ IDEA\" class=\"wp-image-522199\" style=\"aspect-ratio:2.5;width:801px;height:auto\"\/><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>By following these tips, you can optimize your workflow, save time, and make working with databases more productive and enjoyable. Check out <a href=\"https:\/\/www.jetbrains.com\/pages\/intellij-idea-databases\/\" target=\"_blank\" rel=\"noopener\">this page<\/a> to learn more about the database tools in IntelliJ IDEA.<\/p>\n\n\n\n<p>Happy developing!<\/p>\n","protected":false},"author":1400,"featured_media":541271,"comment_status":"closed","ping_status":"closed","template":"","categories":[601],"tags":[2934,6717],"cross-post-tag":[],"acf":[],"_links":{"self":[{"href":"https:\/\/blog.jetbrains.com\/pt-br\/wp-json\/wp\/v2\/idea\/541248"}],"collection":[{"href":"https:\/\/blog.jetbrains.com\/pt-br\/wp-json\/wp\/v2\/idea"}],"about":[{"href":"https:\/\/blog.jetbrains.com\/pt-br\/wp-json\/wp\/v2\/types\/idea"}],"author":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/pt-br\/wp-json\/wp\/v2\/users\/1400"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/pt-br\/wp-json\/wp\/v2\/comments?post=541248"}],"version-history":[{"count":9,"href":"https:\/\/blog.jetbrains.com\/pt-br\/wp-json\/wp\/v2\/idea\/541248\/revisions"}],"predecessor-version":[{"id":666458,"href":"https:\/\/blog.jetbrains.com\/pt-br\/wp-json\/wp\/v2\/idea\/541248\/revisions\/666458"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/pt-br\/wp-json\/wp\/v2\/media\/541271"}],"wp:attachment":[{"href":"https:\/\/blog.jetbrains.com\/pt-br\/wp-json\/wp\/v2\/media?parent=541248"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/pt-br\/wp-json\/wp\/v2\/categories?post=541248"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/pt-br\/wp-json\/wp\/v2\/tags?post=541248"},{"taxonomy":"cross-post-tag","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/pt-br\/wp-json\/wp\/v2\/cross-post-tag?post=541248"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}