Only generate pages and controller, skip entities

4 views
Skip to first unread message

Erick de Oliveira Leal

unread,
Aug 15, 2015, 6:52:04 PM8/15/15
to minuteproject
Hello, I want to generate a Primefaces + JPA controllers and pages.
But I already have an 'model' package with my entities, is it possible to skip the generations of entities?
Because I modified a lot my model, apllying alias and etc... So I do not want to modify again, since I have more than 100 tables. Thanks.

Florian Adler

unread,
Aug 16, 2015, 5:46:15 AM8/16/15
to minute...@googlegroups.com
Hello Erick,

I need to know a bit more about your first model. Has it been generated by minuteproject?
If this is the case and you have just altered some variable name to fit your convention, then it should be possible by a simple technic described at https://minuteproject.wikispaces.com/Updatable_Generated_Code

The principle is to provide a tag MP-MANAGED-STOP-GENERATING in format of a file comment (ex: //MP-MANAGED-STOP-GENERATING for java) at any line in the JPA class (normally at the top). When you generate to the same location then minuteproject merge the artifacts (new one with existing one), if it finds this instruction (MP-MANAGED-STOP-GENERATING) then it skips the override, meaning that the new one is not created.
In this case, by adding this instruction in all your java classes then you prevent them from being refreshed.
To activate it add in your conf

<configuration>
        <conventions>
            <target-convention type="enable-updatable-code-feature" />
        </conventions>



Another question:
Do you work with generation from the console or via a config file via command line?
If you work with config file minuteproject tries to gather lots of conventions and enrichment technics that make your code look smarter (pk, fk conventions, alias, m2m naming...) at https://minuteproject.wikispaces.com/Configuration

I hope it helped,

Best regards,

Florian.


--
Vous recevez ce message, car vous êtes abonné au groupe Google Groupes "minuteproject".
Pour vous désabonner de ce groupe et ne plus recevoir d'e-mails le concernant, envoyez un e-mail à l'adresse minuteprojec...@googlegroups.com.
Pour obtenir davantage d'options, consultez la page https://groups.google.com/d/optout.

Erick de Oliveira Leal

unread,
Aug 16, 2015, 11:23:50 AM8/16/15
to minute...@googlegroups.com

I'll try it soon. It does skips transient fields? And I need to put every classes in the configuration or I can just write the package all my domain classes are?

Vous recevez ce message, car vous êtes abonné à un sujet dans le groupe Google Groupes "minuteproject".
Pour vous désabonner de ce sujet, visitez le site https://groups.google.com/d/topic/minuteproject/8ynS7zPACW4/unsubscribe.
Pour vous désabonner de ce groupe et de tous ses sujets, envoyez un e-mail à l'adresse minuteprojec...@googlegroups.com.

Florian Adler

unread,
Aug 17, 2015, 5:11:34 AM8/17/15
to minute...@googlegroups.com
Hi Erick,

If you put MP-MANAGED-STOP-GENERATING as a comment in the java classes, those ones will not be generated again so your transient field will be kept as well as the other (your class will not be touched).
Meanwhile if you have only transient field that where added (ie no modification of generated code but add new code in the class) there is another strategy that can be interested to use:
Put this new code between // MP-MANAGED-ADDED-AREA-BEGINNING and // MP-MANAGED-ADDED-AREA-ENDING comments so that it will not be erased at the next generation but merged.

So what you need is to activate "enable-updatable-code-feature" at the configuration level and at the artifacts level add the merge comment tips (MP-MANAGED-STOP-GENERATING or // MP-MANAGED-ADDED-AREA-BEGINNING and // MP-MANAGED-ADDED-AREA-ENDING)

Best regards,

Florian.
Reply all
Reply to author
Forward
0 new messages