[forge-issues] [JBoss JIRA] (FORGE-1479) Explicitly setup in Bean Validation, not in JPA

Antonio Goncalves (JIRA) issues at jboss.org
Wed Jan 22 16:46:28 EST 2014


    [ https://issues.jboss.org/browse/FORGE-1479?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12938043#comment-12938043 ] 

Antonio Goncalves commented on FORGE-1479:
------------------------------------------

It's either one or the other. At the moment, if you do not setup jpa, you can still create entities (but it doesn't work because there is no persistence.xml). If you do not setup Bean Validation, you cannot add a constraint. 

Forge 1.x goes "you need to set it up before using it", but I wonder if Forge 2.x should go "I will set it up for you if you do not explicitelly tell me otherwise". I like this approach (less typing, less bugs), but it's up to you
                
> Explicitly setup in Bean Validation, not in JPA
> -----------------------------------------------
>
>                 Key: FORGE-1479
>                 URL: https://issues.jboss.org/browse/FORGE-1479
>             Project: Forge
>          Issue Type: Sub-task
>          Components: UI - Shell
>    Affects Versions: 2.0.0.CR1
>            Reporter: Antonio Goncalves
>             Fix For: 2.x Future
>
>
> Just after a creating a project, a create a new entity without setting up the persistence ({{jpa-setup}}) : 
> {code}
> ***SUCCESS*** Project named 'test' has been created.
> [test]$ jpa-new-entity --named Author
> [Author.java]$ jpa-new-field --named firstname --length 50
> ***SUCCESS*** Field firstname created
> {code}
> This hasn't created a {{persistence.xml}} file. But on the other hand, if I want to add a constraint on the entity, I need to explicitelly setup Bean Validation : 
> {code}
> [Author.java]$ con
> connection-profile-create  connection-profile-remove  constraint-setup
> [Author.java]$ constraint-setup
> ***SUCCESS*** Bean Validation is installed.
> [Author.java]$ con
> connection-profile-create  connection-profile-remove  constraint-add  constraint-setup
> [Author.java]$ constraint-add --constraint NotNull --onProperty firstname
> ***SUCCESS*** Constraint NotNull successfully configured
> {code}
> if most of the information is giving at project creation, do we still need to explicitly setup Java EE components ? At the moment we have the following :
> {code}
> servlet-setup
> ejb-setup
> soap-setup
> cdi-setup
> jms-setup
> rest-setup
> jpa-setup
> faces-setup
> jstl-setup
> jta-setup
> constraint-setup
> {code}
> Most of these commands do not have parameters (except for persistence, rest, validation). So why not activate them by default (or only if {{export ACCEPT_DEFAULTS=true}} ) ? Something like : "if the command {{constraint-add}} is entered, Forge would go {{if constraint is not setup, then I invoke constraint-setup}}",  "if the command {{ejb-new}} is entered, Forge would go {{if ejb is not setup, then I invoke ejb-setup}}"
> That would save some bugs (developers forgetting to setup things), less typing and shorter scripts.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the forge-issues mailing list