Configurando o persistence.xml pro MySQL

Estou acompanhando um tutorial aqui, que no caso utiliza o postgresql, só que eu estou utilizando o mysql como eu adapto esse persistence.xml para o mysql?

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence">
    <persistence-unit name="vraptor">
    <provider>org.hibernate.ejb.HibernatePersistence</provider>
    <class>br.com.k2studio.vraptor.entity.Grupo</class>
    <class>br.com.k2studio.vraptor.entity.Usuario</class>
        <properties>
            <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />
            <property name="hibernate.connection.url" value="jdbc:postgresql://localhost:5432/teste" />
            <property name="hibernate.connection.driver_class" value="org.postgresql.Driver" />
            <property name="hibernate.connection.username" value="postgres" />
            <property name="hibernate.connection.password" value="postgres" />
        </properties>
     </persistence-unit>
</persistence>

Por favor, não é, camarada?
Isso que eu chamo de preguiça…
Qualquer busca no google traz vários resultados…

Segue um xml que sempre uso:

<persistence version="2.0"
	xmlns="http://java.sun.com/xml/ns/persistence" 
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
	http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">

	<!-- UNIDADE DE TESTES -->
	<persistence-unit name="test">
	
		<provider>org.hibernate.ejb.HibernatePersistence</provider>
		<jar-file>${project.build.outputDirectory}</jar-file>
		
		<properties>
			<!-- DADOS CONEXAO -->
			<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver" />
			<property name="hibernate.connection.username" value="myfinances" />
			<property name="hibernate.connection.password" value="sourcesphere" />
			<property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/sourcesphere_myfinances" />
			<property name="hibernate.default_schema" value="sourcesphere_myfinances"/>
		
			<!-- CONFIGURACAO -->
			<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect" />
			<property name="hibernate.hbm2ddl.auto" value="update" />
			<property name="hibernate.show_sql" value="true" />
			<property name="hibernate.format_sql" value="true" />
			<property name="hibernate.archive.autodetection" value="class" />
			
			<!-- POOL -->
			<property name="hibernate.c3p0.min_size" value="5"/>
			<property name="hibernate.c3p0.max_size" value="20"/>
			<property name="hibernate.c3p0.timeout" value="300"/>
			<property name="hibernate.c3p0.max_statements" value="50"/>
			<property name="hibernate.c3p0.idle_test_period" value="3000"/>
		</properties>
		
	</persistence-unit>
	
</persistence>

[quote=drsmachado]Por favor, não é, camarada?
Isso que eu chamo de preguiça…
Qualquer busca no google traz vários resultados…[/quote]

não os resultados que procuro. obrigado de qualquer forma.

Porque nao sabe ou nao insiste em continuar procurando.

[quote=guilherme.dio]Segue um xml que sempre uso:

[code]

<!-- UNIDADE DE TESTES -->
<persistence-unit name="test">

	<provider>org.hibernate.ejb.HibernatePersistence</provider>
	<jar-file>${project.build.outputDirectory}</jar-file>
	
	<properties>
		<!-- DADOS CONEXAO -->
		<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver" />
		<property name="hibernate.connection.username" value="myfinances" />
		<property name="hibernate.connection.password" value="sourcesphere" />
		<property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/sourcesphere_myfinances" />
		<property name="hibernate.default_schema" value="sourcesphere_myfinances"/>
	
		<!-- CONFIGURACAO -->
		<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect" />
		<property name="hibernate.hbm2ddl.auto" value="update" />
		<property name="hibernate.show_sql" value="true" />
		<property name="hibernate.format_sql" value="true" />
		<property name="hibernate.archive.autodetection" value="class" />
		
		<!-- POOL -->
		<property name="hibernate.c3p0.min_size" value="5"/>
		<property name="hibernate.c3p0.max_size" value="20"/>
		<property name="hibernate.c3p0.timeout" value="300"/>
		<property name="hibernate.c3p0.max_statements" value="50"/>
		<property name="hibernate.c3p0.idle_test_period" value="3000"/>
	</properties>
	
</persistence-unit>
[/code][/quote]

obrigado!

[quote=Steam][quote=drsmachado]Por favor, não é, camarada?
Isso que eu chamo de preguiça…
Qualquer busca no google traz vários resultados…[/quote]

não os resultados que procuro. obrigado de qualquer forma.[/quote]Eu nunca sei de cabeça, e sempre pego no google.

Da proxima vez, pesquise por:
jpa mysql persistence.xml

Por esse tipo de pesquisa eu sempre encontrei qualquer banco de dados. =D

[quote=Steam]Estou acompanhando um tutorial aqui, que no caso utiliza o postgresql, só que eu estou utilizando o mysql como eu adapto esse persistence.xml para o mysql?

[code]

<?xml version="1.0" encoding="UTF-8"?> org.hibernate.ejb.HibernatePersistence br.com.k2studio.vraptor.entity.Grupo br.com.k2studio.vraptor.entity.Usuario [/code][/quote]

Olhe esse link http://www.patternizando.com.br/2011/08/configuracao-persistence-xml-jpa-para-mysql-derby-h2-oracle-postgresql-sql-server-e-hsqldb-para-hibernate/

guilherme.dio

Obrigado, me ajudou o seu arquivo. Funcionou perfeitamente.