Hello everybody
I have a problem storing my objects with Hibernate. The following code is part of a EJB Session Bean and is called by a JSP:
public String getEchoString(String clientString) { InitialContext ctx; try { ctx = new InitialContext(); SessionFactory factory; factory = (SessionFactory) ctx.lookup("java:/hibernate/SessionFactory"); Session hsession = factory.openSession(); Transaction tx = hsession.beginTransaction(); Entry newEntry = new Entry(); newEntry.setEntry(clientString); newEntry.setEntrydate(new java.util.Date()); hsession.save(newEntry); //hsession.flush(); tx.commit(); hsession.close(); } catch (NamingException e) { e.printStackTrace(); } return clientString + " - from session bean"; }