Author Archive

IntelliJ IDEA 11: New and Noteworthy in Database Realm

Wednesday, December 7th, 2011

There are many little things in database and SQL area that got attention in yesterday’s IntelliJ IDEA 11 release but now I just want to highlight the major ones.

Data Sources view got a new look and now includes stored procedures both from DDL scripts and real databases. The existing SQL dialects support has been redesigned with two new dialects introduced: H2 and MS Transact-SQL. So the list of supported SQL languages now looks like this:

Data Sources Toolwindow
  • MySQL 5.6
  • PostgreSQL 9.0.5
  • Oracle 11.2
  • SQLite 3.7
  • SQL Server 10.50
  • Derby 10.8
  • HSQLDB 2.2
  • H2 1.3
  • SQL-92

   Featuring:

  • Exact syntax as in docs
  • Context-aware completion
  • PL-extensions support

Database view:

  • Includes stored procedures. Search for usages, navigate to, drag and drop to editor, etc.
  • Working with large databases is now less painful. Tables and procedures are available the moment their names are loaded. Columns, procedure parameters and other information are loaded in background afterwards.
  • If something is changed there’s no need to wait for the whole synchronization. Refresh only selected schemas, tables or procedures.

Database Console:

  • Console now remembers its state so you won’t lose statements you have never run.
  • If you do not want to switch editors back and forth you can run statements directly from an SQL file or any other place where SQL injection takes place: invoke “Run Query in Console” intention for the first time then use console “Execute” action shortcut as if you are in console.
  • Transact-SQL batch execution mode (the toggle is hidden in the console properties dialog)
  • Console editor now can be undocked and split as any other editor.

Enjoy.

Find Table/Column Usages Searches Database Schema

Friday, April 22nd, 2011

In IDEA 10.5 “Find Usages” (Alt-F7) results for tables and columns include database schema usages, i.e. references in indices, primary and foreign keys, see screenshot below:

Develop with pleasure!

Database Table Editor in IntelliJ IDEA 10

Monday, August 30th, 2010

IntelliJ IDEA X features a simple database table editor and viewer. You can add and remove rows, sort by specific column and choose columns to display just by pressing F4 on a table in the Data Sources view.

If you find the console-like way better than the GUI way, you can still run all those delete from… and insert into… statements in the Database console.

Try this in the latest IntelliJ IDEA 10 EAP and let us know your thoughts on it.

Hibernate Criteria API Supported in IntelliJ IDEA X

Tuesday, August 17th, 2010

Since IntelliJ IDEA X property names can be completed and navigated. Unrecognized properties are highlighted by the corresponding inspection.

The screenshot says it all in a visual manner.

Download IntelliJ IDEA X EAP build and try this feature.

Getting External Libraries Easily

Friday, August 13th, 2010

JARs of many frameworks and their dependencies get updated too often now. But you do not want to turn your project into a Maven project just because of this? Then this feature is just for you.

In IntelliJ IDEA 10 you can search for & download libraries with dependencies for any framework published on some public maven repository. Minimum Maven experience is required. Just click ‘Attach Classes from Repository…

You can add your company repository to the list of searched repositories, if it is managed by Nexus, by providing the Nexus URL in Settings | Maven | Repository Indices | Nexus Locations list.

Try this in IntelliJ IDEA X EAP and let us know how it works for you.

UPDATE JavaDocs & Sources download as well as the Artifactory support are now available.

Full-featured IntelliJ IDEA Editor for Injected Language Fragments

Tuesday, August 10th, 2010

You probably know about IntelliJ IDEA’s language injection feature. Right?

IntelliJ IDEA X takes it even further. Now you can edit fragments of code injected in literals in a designated full featured editor with all your changes immediately reflected in the original code.

You do not see all other code around the injected fragment. There’s no need to worry about code escaping. No modal popups. Just do what you need to. The fragment editor opens in a convenient split mode remembering your caret position and closes instantly when Esc is pressed.

The feature is available for any combination of injected language that IntelliJ IDEA supports, e.g. SQL in Java, HTML in JavaScript, and many others.

All the editor functionality including completion, code inspections, intention and code style actions is of course available in the fragment editor.

And a couple of examples. JPA QL fragment editor:

HTML fragment editor:

Your feedback is welcome!

JPA Console is Available in IntelliJ IDEA 10

Monday, August 9th, 2010

In IntelliJ IDEA 10 a new JPA Console is added to existing Hibernate and Database consoles. Now you can run and test your JPA queries in a target environment of your application.

Both Hibernate and JPA consoles are available if applicable.

Note the new “Run Query in Console” Intention Action that is now available on all the supported types of queries: JPA QL, Hibernate QL and SQL. It allows you to quickly run a query directly from the editor in a corresponding console either new or already running.

IntelliJ IDEA: JPA Console

Database Access Improved

Monday, March 1st, 2010

The latest IntelliJ IDEA 9.0.2 EAP contains a big number of Database-related functionality changes:

  • Database Console now has its own toolwindow
  • New console-like UI that keeps input and output in one place and retains the highlighting for execution history
  • Keyboard shortcuts for all Console actions are now configurable
  • Per-result Page Up, Page Down and Refresh actions
  • Complete support for In-Memory Databases (try running some DDL in Console then click Refresh Tables and all the tables will be loaded in the Data Sources tree)
  • Improved support for heavy JDBC drivers that use native libraries to run
  • The notion of Database Connection allows IntelliJ IDEA to do some cool stuff such as Quick Table Contents Lookup integrated with Quick Documentation Lookup (Ctrl+Q)

The Hibernate Console has also been improved accordingly (separate toolwindow, console-like UI and per-result paging actions).

Try all this in the latest EAP and let us know what you think.

UPD: In the next EAP SQL scripts can be run directly from Project View or Editor via Run SQL Script (Ctrl+Shift+F10).

Drag’n'Drop in Database Diagram

Monday, March 1st, 2010

Since IntelliJ IDEA 9.0.2 Database Diagram supports drag-and-drop for adding more tables to the view. The screenshot below shows the way to access the diagram if you somehow missed the What’s New in 9.0 page.

You can try this right now in the latest EAP.

JPA 2.0 Typesafe Criteria API and Annotation Processing Howto

Thursday, November 19th, 2009

Maia build subsystem now recognizes Java Annotation Processors. Most of JPA 2.0 implementations are expected to make use of the Pluggable Annotation Processing API to automatically generate static metamodel classes. Here is a list of steps required to generate JPA 2.0 metamodel and keep it up-to-date with Hibernate Static Metamodel Generator. For the simplicity in this sample project the processor jar file is added to the module dependencies.

  • Enable annotation processing
  • Select Obtain processors from project classpath option
  • Add a processor class name to the Processors list
  • Add a module with annotated classes to the list of modules to process
  • To output generated classes to a generated directory under module content root, set Generated Sources Directory Name to generated. Note that this directory will not be set as a source root automatically.

Now, Annotation processors will be run every time you invoke Make or Compile. Besides, there is a special menu item Process Annotations that does exactly what its name says. In this sample project I have added the generated directory to project sources to get completion in JPA 2.0 Typesafe Criteria API calls. Enjoy, Comment.



UPDATE: For all those having troubles configuring EclipseLink CanonicalModelProcessor here is the preconfigured sample project with plain JPA and Web+JPA modules.