This is one of the fundamental problems of EJB :)
Well, the answer is negative: you can't have a non-writable field in the
table, Orion (and not only Orion) will always complain. Instead, you would
have to generate your own unique ids.
- you can generate unique ids with the UID class (based on
java.rmi.server.UID and System.currentTimeMillis)
- you can have an EJB for autoincrementing fields.
Vlad
> Greetings!
>
> I have a simple table:
>
> CREATE TABLE UserInfo (
> userID int IDENTITY(1,1) NOT NULL,
> userCode varchar(15)
> );
>
> I have made a simple entity bean to manipulate this table (in real life it
> contains many more fields). How do I cause Orion to read the userID via a
> function getuserID() but *NOT* write to it when creating a new record, or
> entity bean:
>
> UserInfo ui = userInfoHome.create('JEREMY');
>
> ??? I will always get a CreateException:
>
> javax.ejb.CreateException: Error creating EntityBean: [ADAM]Cannot insert
> explicit value for identity column in table 'UserInfo' when IDENTITY_INSERT
> is set to OFF.
>
> Can anyone help?
>
> Jeremy Cowgar - [EMAIL PROTECTED]
> Christian Brotherhood Newsletter