I think you will want to use nullable=false in the column definition.
James wrote a good response to a related question on the difference between nullable vs optional here:
http://www.eclipse.org/forums/index.php/mv/tree/203116/#page_topBest Regards,
Chris
On 19/07/2012 5:18 PM, Noah White wrote:
I have an Entity with some attributes which look like so:
@Basic(optional = false)
private Long X1;
@Basic(optional = false)
private Long Y1;
My persistence.xml has (among other things):
<property name="eclipselink.target-database" value="Oracle"/>
<property name="eclipselink.ddl-generation" value="create-tables"/>
<property name="eclipselink.ddl-generation.output-mode" value="sql-script"/>
<property name="eclipselink.application-location" value="C:\ddl"/>
In the create DDL files generated by Eclipselink I am seeing that these columns do not have the NOT NULL constraint on them, rather they look like so:
CREATE TABLE BOX ( ... , X1 NUMBER(19) NULL, Y1 NUMBER(19) NULL, ... )
My understanding of the 'optional' attribute is that it would tell the schema generation process to use NOT NULL so this is surprising to me.
I'm using Eclipselink 2.3.2.v201111250r10461.
-Noah
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users