Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for generating Micronaut Data entity classes end repository interfaces added. #3584

Merged
merged 9 commits into from
Feb 18, 2022

Conversation

dbalek
Copy link
Contributor

@dbalek dbalek commented Feb 10, 2022

  • Generator for Micronaut Data entity classes from database added.
  • Generator for Micronaut Data repository interfaces from entity classes added.
  • Both generators are available form New Form Template wizard in NetBeans and VSCode.

@dbalek dbalek added the LSP [ci] enable Language Server Protocol tests label Feb 10, 2022
@dbalek dbalek added this to the NB14 milestone Feb 10, 2022
@dbalek dbalek changed the title Support for generating Micronaut Data entity classes from database added. Support for generating Micronaut Data entity classes end repository interfaces added. Feb 16, 2022
Copy link

@JaroslavTulach JaroslavTulach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we build the customization of templates around FileBuilder as introduced by @sdedic?

ConnectionManager.getDefault().connect(connection);
Connection conn = connection.getJDBCConnection();
ResultSet rs = conn.getMetaData().getTables(conn.getCatalog(), conn.getSchema(), "%", new String[]{"TABLE", "VIEW"}); //NOI18N
List<NotifyDescriptor.QuickPick.Item> dbItems = new ArrayList<>();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's ask @sdedic , but I believe createFromTemplate(CreateDescriptor desc) was never intended for displaying UI. I'd rather see that user-related code in a separate method which could be invoked by Swing as well as VSCode UI optionally.

return name != null ? builder.name(name) : null;
});
}
return CompletableFuture.completedFuture(builder);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is weird. If there is no handler we ask for a name. If there is some handler then we assume it will handle all the UI on itself. That's a change in the API. Handlers could have been written for NetBeans 13 for completely different reason.

Some other way to find out hander wants to provide additional customization is desirable.

Copy link
Contributor Author

@dbalek dbalek Feb 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be IMHO solved as a separate PR. Once we agree upon how to provide an additional customization via handler, the implementation could be easily changed without breaking any API.
Also, an additional configuration could be useful for other templates, not just the two added by this PR.

Copy link

@JaroslavTulach JaroslavTulach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The check for handler == null to detect that a special UI is present is an incompatible change. The current implementation of Micronaut createFromTemplate that shows dialogs is ugly (but compatible).

I am not going to approve this PR. I am not requesting changes either - I just suggest to come up with better, compatible API.

@JaroslavTulach JaroslavTulach dismissed their stale review February 18, 2022 13:00

I am not going to approve this PR. I am not requesting changes either - I just suggest to come up with better, compatible API.

@dbalek dbalek merged commit 9310f3d into apache:master Feb 18, 2022
@dbalek dbalek deleted the dbalek/micronaut-data branch February 18, 2022 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LSP [ci] enable Language Server Protocol tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants