Re: [JBoss-user] Problems with INSERT statement
On Fri, Jul 20, 2001 at 11:53:04AM +0200, Federico Vesco wrote: > Hi. > > I have a problem making an insert-statement on a PostgresSQL. > All Queries are working well and fast. But if i try to make an insert, it > seems to work > (there is no exception) but nothing has been inserted to the table. Even if > i make an insert and directly after that a query on that entry, the > jdbc-driver finds that entry. But still nothing in the database. > I use JBoss2.2.2, PostgreSQL 7.0.3, Red Hat 7.1 > Few posts ago I sent a solution (workaround is better word) Look at a thread: problems with postgresql > May you help me? > Federico Vesco > > > _ > Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp > > > ___ > JBoss-user mailing list > [EMAIL PROTECTED] > http://lists.sourceforge.net/lists/listinfo/jboss-user -- Tomasz Sulej eo Networks Sp. z o.o. tel. +48 22 622 61 85 kom. +48 606 250 438 ___ JBoss-user mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-user
Re: [JBoss-user] Problem with postgresql
Hmmm... It seems to be solved... But I need explanation why does it work like this? Inserted record appeared in database when I obtained connection within transaction (after tx.begin()) Why I cannot take connection before transaction begins??? -- Tomasz Sulej eo Networks Sp. z o.o. tel. +48 22 622 61 85 kom. +48 606 250 438 ___ JBoss-user mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] Problem with postgresql
Hello, I have a problem with inserting rows from Stateless Session Bean (bean transactions). It dosn't insert. I have a method in the helper class ForumDAO (code below). When I call this method from client application - it works fine, inserted record appears in database, great. But... I've called this method from EJB method, and nothing happens. I've tried all (?) possibilities: Without transaction, connection taken from the pool and not closed (returned) / with closing connection. or Within UserTransaction context with/without closing connection. Inserted record appears in the postgresql log but not in database. It's strange behaviour becouse on the same server I have CMP entity bean with mandatory transaction on one method and this CMP works fine. Jboss 2.4, Postgresql 7.1.2 Please help (I'm going little mad...) Tomasz public class ForumDAO { public boolean addNewForum(Connection conn) { try { String sql = "insert into " PreparedStatement stmt = conn.prepareStatement(sql); [... set some parameters ...] System.out.println("before execute"); stmt.executeUpdate(); System.out.println("after execute"); return true; } catch (Exception e) { e.printStackTrace(); return false; } } } [... bussines method ...] UserTransaction tx = ctx.getUserTransaction(); Connection conn = ... try { tx.begin(); forumDAO.addNewForum(conn); tx.commit(); //conn.close(); } catch (Exception e) { try { tx.rollback(); } catch (Exception er) {} } -- Tomasz Sulej eo Networks Sp. z o.o. tel. +48 22 622 61 85 kom. +48 606 250 438 ___ JBoss-user mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] passivation
Hello, Jboss 2.2.2 + Tomcat I have simple stateful session bean. Only: String getID(); void setID(String); methods I've set max-bean-age time to 60, so after 1min my object was passivated. I've made following actions at the client side: Hashtable tab = new Hashtable(); for(int i = 0; i<110 ; i++) { Synchro obj = home.create(); obj.setID(i + System.currentTimeMillis()); tab.put(new Integer(i), obj); } Thread.sleep(6*2); // wait until passivation occures // this code is executed on passivated object... for(Enumeration e = tab.keys(); e.hasMoreElements();) { Integer key = (Integer)e.nextElement(); Synchro val = (Synchro)tab.get(key); System.out.println(key + ": " + val.getID()); val.remove(); } I got proper results, but... object is not removed. When I repeat (in the same code) for(Enumeration e = tab.keys(); e.hasMoreElements();) { Integer key = (Integer)e.nextElement(); Synchro val = (Synchro)tab.get(key); System.out.println(key + ": " + val.getID()); val.remove(); } Objects are available..., why? I removed this objects by invoking val.remove(). On the server side: [EJBTrans] SynchroEJB (id=null): constructor invoked [EJBTrans] SynchroEJB (id=null): setSessionContext invoked [EJBTrans] SynchroEJB (id=null): ejbCreate invoked [EJBTrans] SynchroEJB (id=null): afterBegin invoked [EJBTrans] SynchroEJB (id=6_994852040662): setID invoked [EJBTrans] SynchroEJB (id=6_994852040662): beforeCompletion invoked [EJBTrans] SynchroEJB (id=6_994852040662): afterCompletion (true) invoked 1 minute later [Container factory] SynchroEJB (id=6_994852040662): ejbPassivate invoked and code (reading Id from bean) twice: [EJBTrans] SynchroEJB (id=null): constructor invoked [EJBTrans] SynchroEJB (id=null): setSessionContext invoked [EJBTrans] SynchroEJB (id=6_994852040662): setSessionContext invoked [EJBTrans] SynchroEJB (id=6_994852040662): ejbActivate invoked [EJBTrans] SynchroEJB (id=6_994852040662): afterBegin invoked [EJBTrans] SynchroEJB (id=6_994852040662): getID invoked [EJBTrans] SynchroEJB (id=6_994852040662): beforeCompletion invoked [EJBTrans] SynchroEJB (id=6_994852040662): afterCompletion (true) invoked [EJBTrans] SynchroEJB (id=6_994852040662): afterBegin invoked [EJBTrans] SynchroEJB (id=6_994852040662): ejbRemove invoked [EJBTrans] SynchroEJB (id=6_994852040662): beforeCompletion invoked [EJBTrans] SynchroEJB (id=6_994852040662): afterCompletion (true) invoked and later the same... -- Tomasz Sulej eo Networks Sp. z o.o. tel. +48 22 622 61 85 kom. +48 606 250 438 ___ JBoss-user mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-user