Hi Marcel,
> I have a question regarding an error I get. In a JSP page I use a
> regular Java bean. Some properties are set and at the end I call the
> bean's create() methode to actually create a new EJB Entity bean.
> Creating the EJB fails: I get the error attached to the end of this
> message. Now the funny part is that the database contains the new EJB
> data. The question I would like to ask you: where to look for the
solution?
> ...
> I have a feeling that my mySQL transaction management is not
> configured properly. These are my mySQL settings in jboss.jcml
If you are using mySQL's default with ISAM or MyISAM table types,
there is NO transactional support, the MySQL docs tell in length
about that issue, why they don't do it and how to code apps that
don't require transactions and still try to be safe. It's not,
that I agree with all their arguments, I think, transactions are
important, especially in the EJB context (where all the tricks,
they give, can't be done), but one has to accept that. Having
no transactions (and no referential integrity) at the DB level
is one reason for MySQL beeing very fast.
So, when your error in the EJBean happens AFTER the DB has done
a successfull INSERT, it isn't funny at all that the record
exists in the DB, even when JBoss does a rollback.
But since version 3.23.15 (2000/05/09) they have the BDB table
type (quote from the MySQL docs):
| 8.5.1 Overview over BDB tables
|
| Berkeley DB (http://www.sleepycat.com) has provided MySQL with a
| transaction-safe table handler. This will survive crashes and
| also provides COMMIT and ROLLBACK on transactions.
And lastly they adopted just another table type 'InnoDB', looking
very promising to me, which is transaction safe and seems to
be very fast too, see http://www.mysql.com/doc/I/n/InnoDB.html.
I didn't try one or the other up to now, please do it and report
us about robustness and speed :-)
> ...
> [Form] javax.ejb.EJBException: ejbCreate: null
> [Form] at
nl.inpact.stam.ejb.form.FormBean.ejbCreate(FormBean.java:168)
A blind guess is, that you don't return a valid primary key from
your ejbCreate(...) method, as it is neccessary with BMP, so the
insert already is done, when the container realizes an error.
And another blind guess is, you use the MySQL AUTO_INCREMENT
feature with your primary key column. With BMP you might do
that, but you have to fetch the auto incremented value back
into your bean (MySQL 'select LAST_INSERT_ID()') and return
it as a primary key class instance. Instead of that, consider
some sort of KeyGenerator, see other threads on this list.
Hope this helps
Georg
___ ___
| + | |__ Georg Rehfeld Woltmanstr. 12 20097 Hamburg
|_|_\ |___ [EMAIL PROTECTED] +49 (40) 23 53 27 10
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user