|
Maybe I am wrong, but from my view, I do not
see a solution of this. I think it would be the easiest way to implement a
stateless SB that calls executes some SQL in a TX=RequiresNew method. If it is
set to TX=RequiresNew, you are sure that the transaction ends after the call and
with that, the database is synchronized to the new high water mark you
calculated in the SQL.
Maybe in EJB 2.0 you could solve this with
Home interfaces, but JOnAS does not provide this feature yet.
I'm also not quite sure if DBMS-generated
values are target of the EJB spec, since EJB intents to have all work done in
beans.
Markus
Hi,
I've written a simple Entity Bean with CMP which
has a primary key of type int.
In the database (Oracle), I have set a
trigger to auto-increment the primary key attribute mapping the
primary key field of the CMP Bean, each time a row is created in the
table.
When calling the ejbCreate method I get an
exception :
javax.ejb.EJBException: Failed to load bean from
database javax.ejb.EJBException java.rmi.RemoteException: Got exception
in activate:; nested exception
is:
javax.ejb.EJBException null EJBContext in RequestCtx! System
Exception raised by request: java.rmi.RemoteException: Got exception in
activate:; nested exception is:
javax.ejb.EJBException System Exception in business
method:java.rmi.RemoteException: Got exception in activate:; nested exception
is:
javax.ejb.EJBException
I have searched on the mailing list some
solutions to get the primary key to increment automatically, but all of them
are quite not suitable :
So here is my question (which maybe you already
have guessed) : Is there a way for the primary key of an Entity Bean with CMP
to be auto-incremented without writting some JDBC code ?
I couldn't find a real answer on the JOnAS
mailing list and I would simply like to know if it's possible or not (and of
course, if it's possible, the way to do it). It seems I'm not the only one
having this problem, so I think it should be sayed once for all at least one
time on the mailing list or the FAQ...
Thanks
Thomas
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
|