Skip to content

Commit

Permalink
Merge pull request #806 from caelum/musicjungle-production
Browse files Browse the repository at this point in the history
Musicjungle production environment
  • Loading branch information
Turini committed Sep 22, 2014
2 parents ec0b85f + a0b0497 commit d7cd130
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
4 changes: 4 additions & 0 deletions vraptor-musicjungle/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ This is an example application to help you to learn about VRaptor.

You can easily import into your IDE as Maven project. Or you can run using maven with commands: `mvn jetty:run` (for Jetty lovers) or `mvn tomcat7:run` (for Tomcat lovers). Wildfly is also available with `mvn -P wildfly wildfly:run`.

This project also works with a production environment as a showcase for vraptor environment, just set your environment to production and configure the persistence.xml

**Warning**: `mvn jetty:run` and `mvn tomcat7:run` does not work with some maven's versions. If you want to use the plugins, we strongly recommend that you update your `mvn` version to `3.2.2` (or the lastest version) so it will works just fine.


Este é um projeto de exemplo para ajudar você a aprender sobre o VRaptor. Você pode facilmente importá-lo na sua IDE favorita como um projeto Maven. Ou você pode rodar este projeto com os comandos do Maven: `mvn jetty:run` ou `mvn tomcat7:run`. Wildfly também está disponível pelo comando `mvn -P wildfly wildfly:run`.

Este projeto também funciona como um showcase do vraptor environment, onde ao configurá-lo para production ele lerá os dados do persistence.xml da unidade mysql e conectará com o mysql configurado lá.

**Nota**: `mvn jetty:run` e `mvn tomcat7:run` não funcionam com algumas versões do maven. Se você pretende usar o plugin recomendamos fortemente que atualize a versão de seu maven para `3.2.2` (ou a mais recente). Assim tudo vai funcionar bem.
5 changes: 5 additions & 0 deletions vraptor-musicjungle/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@
<version>1.3</version>
</dependency>

<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.15</version>
</dependency>
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
Expand Down
17 changes: 17 additions & 0 deletions vraptor-musicjungle/src/main/resources/META-INF/persistence.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,22 @@
<property name="hibernate.hbm2ddl.auto" value="update" />
</properties>
</persistence-unit>
<persistence-unit name="mysql">

<class>br.com.caelum.vraptor.musicjungle.model.Music</class>
<class>br.com.caelum.vraptor.musicjungle.model.User</class>

<properties>
<property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" />
<property name="javax.persistence.jdbc.url" value="jdbc:mysql://MYSQL_SERVER/musicjungle?autoReconnect=true&amp;createDatabaseIfNotExist=true" />
<property name="javax.persistence.jdbc.user" value="MYSQL_USER" />
<property name="javax.persistence.jdbc.password" value="MYSQL_PASSWORD" />

<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect"/>
<property name="hibernate.show_sql" value="false" />
<property name="hibernate.format_sql" value="false" />
<property name="hibernate.hbm2ddl.auto" value="update" />
</properties>
</persistence-unit>

</persistence>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
br.com.caelum.vraptor.jpa.persistenceunit=mysql

0 comments on commit d7cd130

Please sign in to comment.