JBoss 4.0.4, Hibernate 3.0. Data do not saved!

Code in EJB component:

  | ctx = new InitialContext(); 
  | SessionFactory factory = (SessionFactory) 
ctx.lookup("java:/hibernate/SessionFactory"); 
  | Session hsession = factory.openSession(); 
  | Transaction tx = hsession.beginTransaction(); 
  | Orgs orgs = new Orgs("Hibernate test"); 
  | hsession.save(orgs); 
  | tx.commit(); 
  | hsession.close(); 
  | 

In hibernate.org FAQ: wrote
anonymous wrote : 
  | I saved / deleted / updated an object / collection but I can't see the 
changes in the database! 
  | 
  | Hibernate will not execute any SQL until you either call 
Transaction.commit() (if using the Transaction API) or Session.flush() (if you 
are not) at the end of a session to flush your in-memory changes to the 
database. 
  | 
  | If you are not using the Transaction API, you must then explicitly commit 
the transaction (by committing the JTA transaction or JDBC Connection). 
  | 

Therefor on "Transaction.commit()" SQL query must be execute. But do not do 
that, while not execute "hsession.flush()".

But in FAQ wrote, that "Session.flush()" must be using when we do not have 
Transaction.

Where I'm wrong?

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3960123#3960123

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3960123
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to