No description
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-10-20 00:50:55 +05:00
doc docs: add README and vimdoc 2026-10-20 00:37:08 +05:00
lsp feat: add LSP server, :Jpa command, actions dispatch, mapping actions and health 2026-10-20 00:36:13 +05:00
lua/jpa feat: add LSP server, :Jpa command, actions dispatch, mapping actions and health 2026-10-20 00:36:13 +05:00
plugin feat: add LSP server, :Jpa command, actions dispatch, mapping actions and health 2026-10-20 00:36:13 +05:00
tests test: render entity changes through liquibase.nvim 2026-10-20 00:36:27 +05:00
.gitignore chore: initialize repository 2026-10-20 00:15:16 +05:00
.luarc.json chore: initialize repository 2026-10-20 00:15:16 +05:00
.stylua.toml chore: initialize repository 2026-10-20 00:15:16 +05:00
LICENSE chore: initialize repository 2026-10-20 00:15:16 +05:00
Makefile chore: initialize repository 2026-10-20 00:15:16 +05:00
README.md docs: install from git.bivashy.dev 2026-10-20 00:50:55 +05:00

jpa.nvim

JPA helpers for Neovim in the style of IntelliJ IDEA Ultimate and JPA Buddy. The features are offered as LSP code actions (through a small in-process language server) and as :Jpa subcommands. Spring Boot, Quarkus (including Panache) and Micronaut projects built with Maven or Gradle are supported.

Features:

  • Generate a Liquibase changeset from an entity (createTable, sequences, foreign keys, join tables, indexes, unique constraints).
  • Generate an addColumn changeset for the field under the cursor or the selected fields.
  • Create an entity class from a CREATE TABLE statement in a SQL buffer.
  • Generate a DTO, a repository, equals/hashCode, toString, and explicit @Table/@Column names for an entity.

Requirements

  • Neovim 0.11 or newer
  • The java treesitter parser
  • Optional: liquibase.nvim for the Liquibase related actions. Without it, only the code generation features are offered.

Installation

With lazy.nvim:

{
  url = "https://git.bivashy.dev/bivashy/jpa.nvim",
  dependencies = { { url = "https://git.bivashy.dev/bivashy/liquibase.nvim" } }, -- optional
  ft = { "java", "sql" },
}

For a local checkout use dir = "~/path/to/jpa.nvim" instead of url.

Usage

Place the cursor in an entity class and run vim.lsp.buf.code_action(), or use a subcommand:

Subcommand Description
changeset Liquibase changeset for the entity (file saves it)
add-column addColumn changeset for the field or range (file)
entity Entity class from the CREATE TABLE statement at cursor
dto DTO for the entity
repository Repository interface for the entity
equals-hashcode Generate equals and hashCode
tostring Generate toString
explicit-names Add explicit table and column names
info Show the detected project and entity

No keymaps are defined. The following mappings are available (normal and visual mode): <Plug>(jpa-changeset), <Plug>(jpa-add-column), <Plug>(jpa-entity), <Plug>(jpa-dto), <Plug>(jpa-repository), <Plug>(jpa-equals-hashcode), <Plug>(jpa-tostring), <Plug>(jpa-explicit-names).

vim.keymap.set({ "n", "x" }, "<leader>jc", "<Plug>(jpa-changeset)")

The language server attaches to Java buffers that contain an @Entity, @Embeddable or @MappedSuperclass annotation or a JPA import, and to SQL buffers.

Configuration

No setup() call is required. Set vim.g.jpa to a table (or a function returning one) before the plugin loads. require("jpa").setup(opts) is equivalent.

vim.g.jpa = {
  lsp = true,
  naming = nil,          -- nil: "snake_case" for Spring, "as_is" otherwise; or fun(name): string
  string_length = 255,
  entity = { style = nil, subpackage = nil }, -- style: "panache"|"lombok"|"public_fields"|"getters"
  dto = { suffix = "Dto", subpackage = "dto", record = true },
  repository = { suffix = "Repository", subpackage = "repository" },
}

See :help jpa for all options.

Health check

Run :checkhealth jpa to verify the Neovim version, the treesitter parser, liquibase.nvim, the configuration and the detected project.

Tests

make test
NVIM_TEST_RTP=/path/to/liquibase.nvim make test   # includes Liquibase specs