• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate question

 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the tutorial,
http://www.hibernate.org/hib_docs/v3/reference/en/html/tutorial.html

List result = session.createQuery("from Event").list();

Is the "from Event" the class name.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Paul Sturrock:
Yes.


Thanks.
Should we use FQCN if there are classes with same names ?
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As you can see, there is no explicit call to update() or save(), Hibernate automatically detects that the collection has been modified and needs to be updated. This is called automatic dirty checking, and you can also try it by modifying the name or the date property of any of your objects. As long as they are in persistent state, that is, bound to a particular Hibernate Session (i.e. they have been just loaded or saved in a unit of work), Hibernate monitors any changes and executes SQL in a write-behind fashion. The process of synchronizing the memory state with the database, usually only at the end of a unit of work, is called flushing. In our code, the unit of work ends with a commit (or rollback) of the database transaction - as defined by the thread configuration option for the CurrentSessionContext class.


Regarding automatic dirty checking- I have a method that load an object from db , modify it and exits. I commit the transaction in another method. Will Hibernate keep track of the changes[commit] done. Please note that the modified object is now out of scope. Thanks
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving up.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic