Hi Paul,

> The code I am using is as follows, I had thought of creating an additional
> bean to do this but was wondering if there was an easier way.
>    [code cut, see Pauls mail]

> [Section] java.lang.Error: id may not be null
> [Section]       at org.jboss.ejb.CacheKey.<init>(CacheKey.java:51)
> [Section]       at
>
org.jboss.ejb.plugins.EntityInstanceCache.createCacheKey(EntityInstanceCache
> .java:47)
>    [rest of trace cut]

This exception is thrown in the container, not in JAWS. So you
only have the chance to use a KeyGenerator().

And again reading the EJB spec 1.1 section 9.4.2 paragraph six
I found:

| The container may create the representation of the entity in the
| database immediately after ejbCreate(...) returns, or it can defer it to
| a later time (for example to the time after the matching
| ejbPostCreate(...) has been called, or to the end of the transaction).

So, to remain portable to other EJB implementations, you even
havn't the chance to use ejbPostCreate to access the autoincrement
value, as the DB access might have not been done already (though
with JAWS the insert is done between ejbCreate and ejbPostCreate).

regards

Georg
 ___   ___
| + | |__    Georg Rehfeld      Woltmanstr. 12     20097 Hamburg
|_|_\ |___   [EMAIL PROTECTED]           +49 (40) 23 53 27 10

PS: In one of my earlier mails (on another but similar thread in
    this list) I argued against Marc Fleurys proposal of a 'mixed mode'
entity bean, where the bean is essentially CMP but the create methods
(and finders) are BMP. I must have been too tired at the time of
writing that, a 'mixed mode' would help a lot with autoincrements
and sequences. See
http://www.mail-archive.com/jboss-user@lists.sourceforge.net/msg04776.html



_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to