<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Marcos Sousa's Blog &#187; PostGreSQL</title>
	<atom:link href="http://www.marcossousa.com/tag/postgresql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.marcossousa.com</link>
	<description>Blog sobre desenvolvimento de software</description>
	<lastBuildDate>Fri, 06 Jan 2012 15:31:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>No Dialect mapping for JDBC type: 7</title>
		<link>http://www.marcossousa.com/2008/01/12/no-dialect-mapping-for-jdbc-type-7-2/</link>
		<comments>http://www.marcossousa.com/2008/01/12/no-dialect-mapping-for-jdbc-type-7-2/#comments</comments>
		<pubDate>Sat, 12 Jan 2008 15:49:41 +0000</pubDate>
		<dc:creator>Marcos Sousa</dc:creator>
				<category><![CDATA[Hibernate]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JDBC type: 7]]></category>
		<category><![CDATA[No Dialect mapping for JDBC type: 7]]></category>
		<category><![CDATA[PostGreSQL]]></category>

		<guid isPermaLink="false">http://www.marcossousa.com/2008/01/12/no-dialect-mapping-for-jdbc-type-7-2/</guid>
		<description><![CDATA[This is one exception that can occur one day when you are using Hibernate and PostgreSQL. Basically it occur when you have an entity that has one float mapped property and you create one HQL query using the HQL built-in-functions, such as: SUM, AVG, COUNT, with left outer joins or simple queries. org.hibernate.MappingException: No Dialect [...]]]></description>
			<content:encoded><![CDATA[<p>This is one exception that can occur one day when you are using Hibernate and PostgreSQL. Basically it occur when you have an entity that has one float mapped property and you create one HQL query using the HQL built-in-functions, such as: SUM, AVG, COUNT, with left outer joins or simple queries.</p>
<pre class="brush: java;">org.hibernate.MappingException: No Dialect mapping for JDBC type: 7</pre>
<p>There are two ways to solve the problem: the first is to change property type to Double and the second is to create a customized dialect:</p>
<pre class="brush: java;">

public class PostgreSQLDialect extends org.hibernate.dialect.PostgreSQLDialect {

public PostgreSQLDialect() {
super();
registerColumnType(Types.REAL, “number($p,$s)” );
registerHibernateType(Types.REAL, “float”);
}

}
</pre>
<p>SQL type 7 corresponds to JDBC float type, then we need to register column data type and register hibernate data type too.</p>
<p><a href="http://www.marcossousa.com/2007/10/30/no-dialect-mapping-for-jdbc-type-7" title="Acessar post em português">Portuguese version</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.marcossousa.com/2008/01/12/no-dialect-mapping-for-jdbc-type-7-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>No Dialect mapping for JDBC type: 7</title>
		<link>http://www.marcossousa.com/2007/10/30/no-dialect-mapping-for-jdbc-type-7/</link>
		<comments>http://www.marcossousa.com/2007/10/30/no-dialect-mapping-for-jdbc-type-7/#comments</comments>
		<pubDate>Wed, 31 Oct 2007 01:17:02 +0000</pubDate>
		<dc:creator>Marcos Sousa</dc:creator>
				<category><![CDATA[Hibernate]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JDBC type: 7]]></category>
		<category><![CDATA[No Dialect mapping for JDBC type: 7]]></category>
		<category><![CDATA[PostGreSQL]]></category>

		<guid isPermaLink="false">http://www.marcossousa.com/?p=38</guid>
		<description><![CDATA[Esta é uma exception que pode ocorrer algum dia com você quando estiver usando Hibernate e PostgreSQL. Basicamente ela ocorre quando você tem um a entidade que tem uma propriedade mapeada do tipo float, e você tenta criar uma consulta HQL usando as built-in-functions (sum, avg, count, etc), fazendo left outer joins, ou até mesmo [...]]]></description>
			<content:encoded><![CDATA[<p>Esta é uma exception que pode ocorrer algum dia com você quando estiver usando Hibernate e PostgreSQL. Basicamente ela ocorre quando você tem um a entidade que tem uma propriedade mapeada do tipo float, e você tenta criar uma consulta HQL usando as built-in-functions (sum, avg, count, etc), fazendo left outer joins, ou até mesmo com consultas simples.</p>
<p><em> org.hibernate.MappingException: No Dialect mapping for JDBC type: 7 </em></p>
<p>Há duas maneiras de resolver o problema: a primeira é alterando o tipo de dados de FLOAT para DOUBLE ou criando um dialeto personalizado:</p>
<p><em>public class PostgreSQLDialect extends org.hibernate.dialect.PostgreSQLDialect {</em></p>
<p><em>    public PostgreSQLDialect() {<br />
super();<br />
registerColumnType(Types.REAL, &#8220;number($p,$s)&#8221; );<br />
registerHibernateType(Types.REAL, &#8220;float&#8221;);<br />
}</em></p>
<p><em>} </em></p>
<p>O SQL type 7, corresponde a dados do Tipo real, então precisamos registrar o tipo de dados da coluna e relacionar este tipo de dados a um tipo de dados do hibernate.</p>
<p><a href="http://www.marcossousa.com/2008/01/12/no-dialect-mapping-for-jdbc-type-7-2/" title="English version">Versão em Inglês</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.marcossousa.com/2007/10/30/no-dialect-mapping-for-jdbc-type-7/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

