Java Mailing List Archive

http://www.gg3721.com/

Home » users.tapestry »

T5: Using with hibernate and Mysql

James Sherwood

2008-10-25

Replies: Find Java Web Hosting

Author LoginPost Reply
Hello,



I was wondering if anyone has a good example of using Tapestry 5 with
Hibernate and Mysql or can tell me what I am doing wrong



I use Eclipse/Tomcat/Mysql.



I created a new project using Maven:

mvn archetype:create -DarchetypeGroupId=org.apache.tapestry
-DarchetypeArtifactId=quickstart -DgroupId=com.james -DartifactId=taphib
-DpackageName=com.james.taphib -Dversion=1.0.0-SNAPSHOT



I added this to my pom.xml



          <dependency>

       <groupId>org.apache.tapestry</groupId>

       <artifactId>tapestry-hibernate</artifactId>

       <version>${tapestry-release-version}</version>

   </dependency>

   <dependency>

       <groupId>mysql</groupId>

       <artifactId>mysql-connector-java</artifactId>

       <version>5.1.5</version>

   </dependency>



I created a filed called: hibernate.cfg.xml in src/main/resources



<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE hibernate-configuration PUBLIC

    "-//Hibernate/Hibernate Configuration DTD 3.0//EN"

    "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>

  <session-factory>

    <property name="hibernate.connection.driver_class">

org.gjt.mm.mysql.Driver</property>

    <property name="hibernate.connection.url
">jdbc:mysql://localhost/dbname?charset=utf8</property>

    <property name="hibernate.dialect">
org.hibernate.dialect.MySQLDialect</property>

    <property name="hibernate.connection.username">user</property>

    <property name="hibernate.connection.password"></property>



  <!-- pool via c3p0 which knows how to reconnect to server and does it

nicely-->

  <property name="connection.provider_class">
org.hibernate.connection.C3P0ConnectionProvider</property>

  <property name="hibernate.c3p0.acquire_increment">1</property>

  <property name="hibernate.c3p0.idle_test_period">100</property> <!--
seconds -->

  <property name="hibernate.c3p0.max_size">10</property>

  <property name="hibernate.c3p0.max_statements">0</property>

  <property name="hibernate.c3p0.min_size">1</property>

  <property name="hibernate.c3p0.timeout">100</property> <!-- seconds -->



  </session-factory>

</hibernate-configuration>





When I try to package using "mvn package" so I can deploy to eclipse I get
the error:

INFO]
------------------------------------------------------------------------

[ERROR] BUILD ERROR

[INFO]
------------------------------------------------------------------------

[INFO] Failed to resolve artifact.



Missing:

----------

1) org.hibernate:hibernate-commons-annotations:jar:3.1.0.GA



Try downloading the file manually from the project website.



Then, install it using the command:

   mvn install:install-file -DgroupId=org.hibernate
-DartifactId=hibernate-co

mmons-annotations -Dversion=3.1.0.GA -Dpackaging=jar -Dfile=/path/to/file



I found a hibernate-commons-annotations.jar but I believe I am doing
something wrong to cause this error.



Thanks,

--James

©2008 gg3721.com - Jax Systems, LLC, U.S.A.