[jboss-user] [JBoss Portal] - Re: Data access / persistence - could you help?
JohnnyTheHun
do-not-reply at jboss.com
Mon Nov 26 15:27:20 EST 2007
I forgot to attach the code that throws the exception:
| InitialContext ctx = new InitialContext();
| SessionFactory factory = (SessionFactory)ctx.lookup("java:/hibernate/SessionFactory");
| Session session = factory.openSession();
|
| Cikk c = new Cikk("Ez az elsÃÂ
ÃÂ db cikk");
|
|
| Transaction tx=null;
| try {
| tx = session.beginTransaction();
| //do some work
| session.save(c);
| tx.commit();
| return true;
| } catch (Exception e) {
| if (tx!=null) tx.rollback();
| response.setRenderParameter("error",e.getMessage());
| throw e;
| } finally {
| if(session.isOpen()) session.close();
| }
|
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4107878#4107878
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4107878
More information about the jboss-user
mailing list