[forge-issues] [JBoss JIRA] (FORGE-2150) jpa-new-field should generate constructor with not null attributes

Antonio Goncalves (JIRA) issues at jboss.org
Sun Nov 16 07:16:39 EST 2014


Antonio Goncalves created FORGE-2150:
----------------------------------------

             Summary: jpa-new-field should generate constructor with not null attributes
                 Key: FORGE-2150
                 URL: https://issues.jboss.org/browse/FORGE-2150
             Project: Forge
          Issue Type: Sub-task
          Components: Java EE
    Affects Versions: 2.12.2.Final
            Reporter: Antonio Goncalves
             Fix For: 2.x Future


When a field is not nullable (either with {{@Column(nullable=false)}} or with a {{@NotNull}} constraint) it would be helpful to generate a constructor with all the needed not null values (and a default constructor).

For example, here, I generate an {{Address}} entity with not null {{street1}} and {{city}}. It would be good to generate a default constructor + another one with these two needed attributes : 

{code}
@Entity
public class Address implements Serializable
{

   @Column(length = 50, nullable = false)
   @Size(min = 5, max = 50)
   @NotNull
   private String street1;

   @Column(length = 50, nullable = false)
   @Size(min = 2, max = 50)
   @NotNull
   private String city;

   public Address()
   {
   }

   public Address(String street1, String city)
   {
      this.street1 = street1;
      this.city = city;
   }
{code}




--
This message was sent by Atlassian JIRA
(v6.3.8#6338)


More information about the forge-issues mailing list