GeneratedValue annotation

GeneratedValue marks a field for which the corresponding table column receives a value that is assigned by the database management system. The assignment occurs during an add statement, which also places the DBMS-generated value into the field.

EGL package name

eglx.persistence.sql

Example use
Consider this custom type:
Record PaymentRec  { @Table {name="PAYMENT"} } 
   paymentId int {@ID, @GeneratedValue, @Column { name="PAYMENT_ID" } };
   description string? { @Column { name="DESCRIPTION" } } ;	
   amount decimal(10,2) { @Column { name="AMOUNT" } } ;
End
You declare a record of that type:
mypayment PaymentRec;
mypayment.description = "shoes";
mypayment.amount = 123.50;
The next declaration lets your code open a database connection at the first database access and in accordance with connection details that are stored in the EGL deployment descriptor entry named ds:
ds SQLDataSource?{@Resource};
Here is an add statement, which places a DBMS-generated value into the PAYMENT_ID column of a new row and into the paymentID field of the record being added:
function addPayment(newPayment PaymentRec in)
   try
      add newPayment to ds;
      onException(ex sqlException)
 
         // invokes a custom exception handler.
         logException(ex);        
    end
end
Annotation detail
Record GeneratedValue type Annotation {
   targets=[FieldMbr]
   }
end
Annotation fields
None.
Comments
Compatibility

Table 1. Compatibility
Target Issue
Java No issues.
JavaScript Database access is not supported.