This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 203659 - Generate new lines between fields of a JPA entity
Summary: Generate new lines between fields of a JPA entity
Status: RESOLVED WONTFIX
Alias: None
Product: javaee
Classification: Unclassified
Component: Persistence (show other bugs)
Version: 7.1
Hardware: PC Mac OS X
: P3 normal (vote)
Assignee: Sergey Petrov
URL:
Keywords: USABILITY
: 191331 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-10-13 14:25 UTC by Petr Jiricka
Modified: 2016-07-07 08:54 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Jiricka 2011-10-13 14:25:40 UTC
Here is a snipped from an entity class generated using Entities from Database:

    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "CUSTOMER_ID")
    private Integer customerId;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 10)
    @Column(name = "ZIP")
    private String zip;
    @Size(max = 30)
    @Column(name = "NAME")
    private String name;

This code is hard to read - it would be useful if there was an empty line after each field.
Comment 1 Sergey Petrov 2011-10-13 14:45:49 UTC
It's the way our java api generate class from class tree, if I extract superclass with refactor action, there will be no newlines also, but may be I can add empty lines to class model, I'm not sure, requires more evaluation.
Also generated code in forms have fields on each line, it may be too custom for persistence фкуф to have newline between ашудвы also it may be user preference dependent.
Comment 2 Sergey Petrov 2011-10-13 14:50:34 UTC
after brief investigation I found option 
Editor|Formatting
Language: Java
Category: blank lines
option "after field".
it's 0 by default and if changes to 1 entity class will be generated with newlines after each field. 
if there is no request to override this option for persistence of have separate configuration for entities from db looks like the issue isn't valid. feel free to reopen if persistence need something special.
Comment 3 Sergey Petrov 2011-11-29 14:27:14 UTC
*** Bug 191331 has been marked as a duplicate of this bug. ***
Comment 4 arungupta 2012-02-13 13:11:30 UTC
Even though there is an option to override the field manually but the generated code still looks ugly. I'd recommend finding a way to exposing it programmatically and then overriding in the JPA entity generators.

I always have to add a blank line to show the fields clearly.
Comment 5 Sergey Petrov 2012-02-13 13:33:51 UTC
It's unclear why it should be specific to persistence?
May it be better to request other defaults in general class format configuration?
Also why you can't change these defaults?
Comment 6 arungupta 2012-02-13 13:36:18 UTC
Actually, thinking more about the general format should be changed itself.

Will that be a separate bug ?

I can change my preferences but when I'm teaching Java EE 6 labs using NetBeans, its cumbersome if everybody has to change it. And its anyway more readable :-)
Comment 7 Sergey Petrov 2012-02-13 13:40:52 UTC
Any generator works this way, as mentioned above "extract super class" and firms but even more simple like "new|Java beans|Java bean" will create java bean with members on each line (yet it may be less fields then usually in an entity).
It it's specific to support customization in place(i.e. wizard step) it's more like enhancment for persistence area, but you can try also to file more general issue.
Comment 8 Sergey Petrov 2012-03-19 09:15:29 UTC
any progress on general issue?
as I said having general functionality to configure newlines, it's more like enhancement to extend some specific wizard to support customization in place so if you don't mind -> enhancement. it may have sense to review also in genral for ide if it's good to have this for most generator's wizards.
Comment 9 Martin Balin 2016-07-07 08:54:13 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss