• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate wont insert - but doesnt throw exceptio

 
jay vas
Ranch Hand
Posts: 407
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys :

Im trying to insert an object using hibernate.

Fid f = new Fid();
f.setPath("C:a/b/c.fid");
session.save(f);

No errors are printed to the screen, but nothing is being inserted in the database... Please help ? Here is a trace of the last few log4j statements.

...
4157 [main] DEBUG org.hibernate.impl.SessionFactoryImpl - Checking 0 named HQL queries
4157 [main] DEBUG org.hibernate.impl.SessionFactoryImpl - Checking 0 named SQL queries
4157 [main] DEBUG org.hibernate.impl.SessionImpl - opened session at timestamp: 4748511515967488
4157 [main] DEBUG org.hibernate.event.def.DefaultSaveOrUpdateEventListener - saving transient instance
4157 [main] DEBUG org.hibernate.event.def.AbstractSaveEventListener - generated identifier: 0, using strategy: org.hibernate.id.Assigned
4157 [main] DEBUG org.hibernate.event.def.AbstractSaveEventListener - saving [dao.Fid#0]
4188 [main] DEBUG org.hibernate.event.def.WrapVisitor - Wrapped collection in role: dao.Fid.procpars
4188 [main] DEBUG org.hibernate.event.def.WrapVisitor - Wrapped collection in role: dao.Fid.fts

thanks
j
 
pascal betz
Ranch Hand
Posts: 547
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
- did you commit the Transaction ? i guess not. then, unless your Connection is set to autocommit (which you should not do) there are no data inserted since no TX was commited

- Turn on SQL logging then you can see what SQL actualy is executed



pascal
 
Staffan Rehnberg
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use session.flush() to force data to be written to the database.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic