<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2117700053793766068</id><updated>2012-02-16T13:47:49.843-08:00</updated><title type='text'>Hibernate</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://achuthan.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2117700053793766068/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://achuthan.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Achuthan</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>3</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2117700053793766068.post-5398992990440839734</id><published>2011-02-01T18:17:00.000-08:00</published><updated>2011-02-01T18:17:52.144-08:00</updated><title type='text'>Hibernate Object States</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;Hibernate has three object states that has been stated below.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color: #3d85c6;"&gt;Transient:&amp;nbsp;&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;strong&gt;* If Object is transient, instance has just been instantiated with &lt;em&gt;new &lt;/em&gt;Operator and it's not associated with Hibernate Sesssion. It has no persistance representation in database and no identifier value has been assigned.&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;* Transient object will be garbage collected if application doesnt have any reference any more. Use the Hibernate session to make an Object persistent.&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color: #3d85c6;"&gt;Persistance:&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;strong&gt;* A persistance instance has a representation in database and an identifier value. It might have been just saved or loaded. It will be associated with a hibenate session. &lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * Hibernate will detect any changes made to an object in persistent state and synchronize the state with the database when the unit of work completes.&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color: #3d85c6;"&gt;Detached:&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #444444;"&gt;* A detached instance is persistence but its session is closed. It&amp;nbsp;will be modified in the current state if the reference of the object is valid.&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * A detached instance can be reattached&amp;nbsp;to a new session and maing it persistent again.&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2117700053793766068-5398992990440839734?l=achuthan.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://achuthan.blogspot.com/feeds/5398992990440839734/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://achuthan.blogspot.com/2011/02/hibernate-object-states_01.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2117700053793766068/posts/default/5398992990440839734'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2117700053793766068/posts/default/5398992990440839734'/><link rel='alternate' type='text/html' href='http://achuthan.blogspot.com/2011/02/hibernate-object-states_01.html' title='Hibernate Object States'/><author><name>Achuthan</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2117700053793766068.post-2197889488800831701</id><published>2011-02-01T18:13:00.000-08:00</published><updated>2011-02-01T19:04:55.989-08:00</updated><title type='text'>what will do load(), get() and referesh() method?</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;strong&gt;&lt;span style="color: #0b5394;"&gt;load()&lt;/span&gt;&lt;/strong&gt; &lt;strong&gt;method is used to retrive the persistence instance if we know the identiifier value. It will throw an unrecoverable exception if there is no matching database row. load() methods of &lt;em&gt;Session &lt;/em&gt;used to take an Object Class and loads to the new Instatantiated instatance.&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color: #0b5394;"&gt;get()&lt;/span&gt; method will not throw an any exception if there is no matching database row. Simply it will return null.&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color: #0b5394;"&gt;reload()&lt;/span&gt;&lt;/strong&gt; &lt;strong&gt;method used to re-load an object and all its collections at any time. This is useful when database triggers are used to initialize some of the properties of the object.&lt;/strong&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2117700053793766068-2197889488800831701?l=achuthan.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://achuthan.blogspot.com/feeds/2197889488800831701/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://achuthan.blogspot.com/2011/02/what-will-do-load-method-get-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2117700053793766068/posts/default/2197889488800831701'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2117700053793766068/posts/default/2197889488800831701'/><link rel='alternate' type='text/html' href='http://achuthan.blogspot.com/2011/02/what-will-do-load-method-get-and.html' title='what will do load(), get() and referesh() method?'/><author><name>Achuthan</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2117700053793766068.post-2172782558394863707</id><published>2011-02-01T17:53:00.000-08:00</published><updated>2011-02-01T19:06:07.542-08:00</updated><title type='text'>What will do the persistent() and save() methods?</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;strong&gt;&lt;span style="color: #0b5394;"&gt;persistent()&lt;/span&gt;&lt;/strong&gt; &lt;strong&gt;method is used to makes transient instance persistent. it does not guarantee that the identifier value will be assigned to the persistent instance immediately, the assignment might happen at flush time. It will not execute the INSERT statement if&amp;nbsp;it is called outside of the transanctions boundaries. &lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;It violates the NOT NULL constraint upon a foreign key.&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color: #0b5394;"&gt;Save()&lt;/span&gt; method will return an identifier.&amp;nbsp;If an INSERT has to be executed to get the identifier ( e.g. "identity" generator, not "sequence"), this INSERT happens immediately, no matter if you are inside or outside of a transaction.&lt;/strong&gt;&lt;strong&gt;&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;It will not violate a NOT NULL constraint.&lt;/strong&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2117700053793766068-2172782558394863707?l=achuthan.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://achuthan.blogspot.com/feeds/2172782558394863707/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://achuthan.blogspot.com/2011/02/difference-between-in-persistent-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2117700053793766068/posts/default/2172782558394863707'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2117700053793766068/posts/default/2172782558394863707'/><link rel='alternate' type='text/html' href='http://achuthan.blogspot.com/2011/02/difference-between-in-persistent-and.html' title='What will do the persistent() and save() methods?'/><author><name>Achuthan</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
