3 Replies Latest reply on Apr 7, 2005 11:16 AM by Bill St. Clair

    Newbie: Transaction problem?

    Bill St. Clair Newbie

      I'm new to JBoss and Hibernate. Have been reading about them for a few months, but am just starting with some real coding. EJB 3 looks a lot easier to deal with than EJB 2., so I'm doing my work there.

      I've coded up something similar to the Entity bean examples, a stateless bean that references an Entity bean. The client accesses the Entity only through the stateless bean.

      Everything is working from the client's perspective, but the data never makes it to the database. I've tried adding an explicit UserTransaction to the client, but it makes no difference.

      Run with jTDS talking to a SQL server database, the table gets locked as soon as I write anything to it, and my DB client (SQuirreL) hangs. Using MySQL, the hang doesn't occur, but I still see no data. Shutting down JBoss gets rid of the hang, but still doesn't write the data.

      Running my EJB client more than once shows that from that perspective, the data is hanging around, so my guess is that it's still cached in memory and hasn't yet been written to the database.

      I've got SQL tracing turned on in hibernate (hibernate.show_sql=true in hibernate.properties), and I see SQL statements that look like it's writing to the database.

      It appears that I somehow have to get Hibernate to flush() its data, but I don't see that anywhere in the documentation.

      I put suitably customized xxx-ds.xml files for both JDBC drivers in jboss/server/all/deploy/

      Does this ring any bells for anyone?