Páginas

domingo, 23 de enero de 2011

Wicket + JPA + Spring

Hello dear friends

I have been this weekend testing the combination of Wicket + JPA + spring. It was Very nice!!!!

At the beginning I discovered a page where to set up easily a project. Using http://www.jweekend.com/dev/LegUp I generated the mvn command to create the project:



mvn archetype:generate -B -DarchetypeCatalog=http://legup.googlecode.com/svn/repo/archetype-catalog.xml -DarchetypeArtifactId=wicket-spring-jpa-archetype -DarchetypeGroupId=com.jweekend -DarchetypeVersion=0.8.4 -DgroupId=com.mycompany -DartifactId=mycompany -Dversion=1.0-SNAPSHOT -Dpackage=com.mycompany


Then I transform the project to be opened by eclipse using the command:

mvn eclipse:eclipse inside the generated project


Then we can run Start.java

In the browser http://localhost:8080/ we will see running the example, using the Event object to persist.

We can change the persistence.xml to connect with mysql


<properties>
<property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/javatest" />
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver" />
<property name="hibernate.connection.password" value="root" />
<property name="hibernate.connection.username" value="root" />
<property name="hibernate.hbm2ddl.auto" value="update" />
</properties>



Be sure also to add mysql to the pom.xml in order to connect to mysql

<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.14</version>
<type>jar</type>
<scope>runtime</scope>
</dependency>


Then we run again the program and the connection with mysql is ready.

3 comentarios:

  1. No man, I am definitely confused...but I do believe it is fine and interesting...

    greetings

    patricio

    ResponderEliminar
  2. Thank you my brother for read my blogs. And also for try to understand my blogs. I have an idea I can start to write about other topics.

    ResponderEliminar
  3. Hello my brother why don't you open your blog!!! It is great

    ResponderEliminar