I've had no trouble creating a database connection and accessing existing beans in the database but when I try to call a create method on the bean below, I do not get any errors but my bean is never inserted into the database. Subsequent calls to create give me an "CreationException that id already exists" but if I restart jboss they're lost. The class seems to be in memory but the bean is never commited. Is there some commit flag I need to set that I don't know about? I've spent entirely to much time on this and would greatly appreciate any help.
<![CDATA[the primary key in the database]]>
<![CDATA[employees first name]]>
<![CDATA[employees last Nme]]>
<!-- oracle data source for our database -->
thanks Michael Fortin
Thanks for the quick reply, but that didn't make any difference. What else could I be missing?
I should mention that I'm using jboss 2.4.4 and oracle 8.1.7
oops, that change was for JBossCMP in JBoss3.0.
I don't relly know 2.4 that well.
I still haven't figured it out. Could some one explain to me what "no transaction right now" in the log output could mean. It seems to be the heart of my problem. I get that line every time I try to create a new bean. thanks...
[INFO,FamDS] XA Connection pool FamDS bound to java:/FamDS
[INFO,FamDS] org.jboss.pool.jdbc.xa.wrapper.XADataSourceImpl created new Connection (oracle.jdbc.driver.OracleConnection
) with XAResource org.jboss.pool.jdbc.xa.wrapper.XAResourceImpl and XAConnection org.jboss.pool.jdbc.xa.wrapper.XAConnec
[INFO,FamDS] No transaction right now.
Does the inserting method run within a tx? Obviously, the entity creation is not committed. I always use a session facade in order to create new entity instances. The method call to the session bean would be marked as tx-required.
(You can also mark the entity-create method as tx-required - although, I read somewhere that this is not spec compliant(anyone?)).
I recommend using xdoclet for ejb generation - this is very convenient (in terms of ejb declarations).
thanks earlgrey and dsundstrom,
I am using xdoclet and changing the transaction to required did the trick. I was under the impression that supports was suffient. I'll chalk it off to a beginners learning experience.
once again thanks thanks thanks.