<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: saveOrUpdate Method in Hibernate</title>
	<atom:link href="http://www.skill-guru.com/blog/2009/10/22/saveorupdate-method-in-hibernate/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.skill-guru.com/blog/2009/10/22/saveorupdate-method-in-hibernate/</link>
	<description>Find free mock and practice test, create and sell tests</description>
	<lastBuildDate>Fri, 03 Feb 2012 01:03:00 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: smitha</title>
		<link>http://www.skill-guru.com/blog/2009/10/22/saveorupdate-method-in-hibernate/comment-page-1/#comment-1167</link>
		<dc:creator>smitha</dc:creator>
		<pubDate>Mon, 11 Jan 2010 09:15:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.skill-guru.com/blog/?p=881#comment-1167</guid>
		<description>@Ayojava,   You can retrieve Entities using HQL like &#039;Select storeDAO from StoreDAO storeDAO&#039; , where StoreDAO is the class name of the Entity.(class which you use to map to HibernateStore table).   With Above HQL query you can retrieve values from HibernateStore table by 
List listVal = listEvents(sessionFactory.getCurrentSession());
System.out.println(”Size &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; ” + listVal.size());
for (int i = 0; i &lt; listVal.size(); i++)
{
StoreDAO store = (StoreDAO)listVal.get(i);
System.out.println(&quot;City: &quot; + store.getCity() + &quot; State: &quot; + store.getState());
}

Hope this helps</description>
		<content:encoded><![CDATA[<p>@Ayojava,   You can retrieve Entities using HQL like &#8216;Select storeDAO from StoreDAO storeDAO&#8217; , where StoreDAO is the class name of the Entity.(class which you use to map to HibernateStore table).   With Above HQL query you can retrieve values from HibernateStore table by<br />
List listVal = listEvents(sessionFactory.getCurrentSession());<br />
System.out.println(”Size &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; ” + listVal.size());<br />
for (int i = 0; i &lt; listVal.size(); i++)<br />
{<br />
StoreDAO store = (StoreDAO)listVal.get(i);<br />
System.out.println(&quot;City: &quot; + store.getCity() + &quot; State: &quot; + store.getState());<br />
}</p>
<p>Hope this helps</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ayojava</title>
		<link>http://www.skill-guru.com/blog/2009/10/22/saveorupdate-method-in-hibernate/comment-page-1/#comment-1149</link>
		<dc:creator>Ayojava</dc:creator>
		<pubDate>Thu, 07 Jan 2010 20:36:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.skill-guru.com/blog/?p=881#comment-1149</guid>
		<description>pls I encounter this problem

-I have been able to save into the database using StoreDAO as the DAO class,but while trying to retrieve the values i get this error ..
Exception &gt;&gt;&gt;&gt;&gt; [Ljava.lang.Object; cannot be cast to com.Hibernate.Test.StoreDAO

the code fragement is below:

List listVal = listEvents(sessionFactory.getCurrentSession());
			System.out.println(&quot;Size &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; &quot; + listVal.size());
			for (int i = 0; i &lt; listVal.size(); i++) 
			{
				StoreDAO store = (StoreDAO)listVal.get(i);
				System.out.println(&quot;City: &quot; + store.getCity() + &quot; State: &quot; + store.getState());
			}

the listevents () method :
private static  List listEvents(Session sess)
	{
		sess.beginTransaction();
		List result = sess.createSQLQuery(&quot;select * from HibernateStore&quot;).list();
		sess.beginTransaction().commit();
		return result;
		}

why can&#039;t i cast the list object returned to the StoreDAO object?</description>
		<content:encoded><![CDATA[<p>pls I encounter this problem</p>
<p>-I have been able to save into the database using StoreDAO as the DAO class,but while trying to retrieve the values i get this error ..<br />
Exception &gt;&gt;&gt;&gt;&gt; [Ljava.lang.Object; cannot be cast to com.Hibernate.Test.StoreDAO</p>
<p>the code fragement is below:</p>
<p>List listVal = listEvents(sessionFactory.getCurrentSession());<br />
			System.out.println(&#8220;Size &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; &#8221; + listVal.size());<br />
			for (int i = 0; i &lt; listVal.size(); i++)<br />
			{<br />
				StoreDAO store = (StoreDAO)listVal.get(i);<br />
				System.out.println(&quot;City: &quot; + store.getCity() + &quot; State: &quot; + store.getState());<br />
			}</p>
<p>the listevents () method :<br />
private static  List listEvents(Session sess)<br />
	{<br />
		sess.beginTransaction();<br />
		List result = sess.createSQLQuery(&quot;select * from HibernateStore&quot;).list();<br />
		sess.beginTransaction().commit();<br />
		return result;<br />
		}</p>
<p>why can&#039;t i cast the list object returned to the StoreDAO object?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

