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
<CODE class=ForumDAO>
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;
}
}
}
</CODE>
<CODE class=ForumNewEJB>
[... 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) {}
}
</CODE>
--
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