I am building a J2SE application with EJB3 and DB Express Express.
My problem is that I am installing an EntityBean in my project that matches the table in the database. The table contains a column that is not null and has a default value . All I want is that when saving new data to this table using EJB, the column value will get its default value. This is how I installed it in the project:
@Basic(optional = true)
@Column(name = "FIRST_NAME", insertable = false, updatable = true, nullable = false)
private String m_firstName;
I also installed it in the ORM.XML file:
<basic name="firstName">
<column name="FIRST_NAME" insertable="false" updatable="true" nullable="false"/>
</basic>
But for some reason, creating a new EntityBean and not setting the first name field, and then trying to save it, I get the following exception:
Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.1 (Build b60e-fcs (12/23/2008))): oracle.toplink.essentials.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: ORA-01400: cannot insert NULL into ("TSDB"."USERS"."FIRST_NAME")
This means that the save manager is trying to insert the first name field, although I told him not to.
- ?
!