0 Replies Latest reply on Apr 28, 2005 9:30 AM by Karen Ploski

    Lock question/problem

    Karen Ploski Newbie

      I'm able to create an EJB3-Hibernate app with Preview 5 and execute it successfully. But there is some behavior going on that I'm not able to explain to myself.

      I have one Stateless bean that uses the remote interface. The client calls it to create a new instance of a persistable object. The bean executes the new operator and calls the persist() method on the entity manager, and returns the new instance to the client.

      At that point, the client calls the bean to execute the merge() method on the new instance. The client then terminates execution normally.

      While JBoss is still running, I start another tool I have that allows me to enter and execute SQL commands, including SELECT and DELETE <table-name> ALL.

      When I use this tool to perform a SELECT, I'm able to retrieve the row that was created by my small application. But when I use the same tool to delete all the rows in the same table, using DELETE <table-name> ALL, the tool does not perform the delete until I shutdown JBoss. At that point, the DELETE removes the one and only row in the table -- the one just inserted by my simple app. So I know the insert worked. What I don't understand is: Why must I shut down JBoss so that the tool can perform the delete?

      My gut feeling is that there is some basic concept or mechanism that I don't understand. It seems like JBoss keeps some lock up on the table even though the app has finished execution. But why? And is there something I can do, either programmatically in my app or to configure JBoss itself, so that I can use this external tool to modify the table?

      In addition to the new operator, the only EJB3 entitymanager methods I use here are persist() and merge().

      I appreciate any/all thoughts/suggestions anyone has to offer.