I have id column in database which is primary key and identity column. I am trying to stop entity from inserting something in this column by annotating it with @column(nullable=false, insertable=false, updatable=false) and instead of not inserting I am getting with kind of exception
Local Exception Stack:
Exception [TOPLINK-0] (Oracle TopLink Essentials - 2006.8 (Build 060830)): oracle.toplink.essentials.exceptions.IntegrityException
Descriptor Exceptions:
---------------------------------------------------------
Exception [TOPLINK-46] (Oracle TopLink Essentials - 2006.8 (Build 060830)): oracle.toplink.essentials.exceptions.DescriptorException
Exception Description: There should be one non-read-only mapping defined for the primary key field [Employess.ID].
Descriptor: RelationalDescriptor(employeeentity.entity.Employess --> [DatabaseTable(Employess)])
Runtime Exceptions:
---------------------------------------------------------
at oracle.toplink.essentials.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:428)
at oracle.toplink.essentials.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:360)
at oracle.toplink.essentials.internal.sessions.DatabaseSessionImpl.postConnectDatasource(DatabaseSessionImpl.java:677)
at oracle.toplink.essentials.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:559)
at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:180)
at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:230)
at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl.java:78)
at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:113)
at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:84)
at com.sun.enterprise.util.EntityManagerWrapper._getDelegate(EntityManagerWrapper.java:331)
at com.sun.enterprise.util.EntityManagerWrapper.persist(EntityManagerWrapper.java:433)
at employeeentity.request.InsertEmployeeBean.createEmployee(InsertEmployeeBean.java:52)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java
what should I do
Thanks
[Message sent by forum member 'chiagng' (chiagng)]
http://forums.java.net/jive/thread.jspa?messageID=224998