Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Tapestry Wiki" for 
change notification.

The following page has been changed by DavorHrg:
http://wiki.apache.org/tapestry/Tapestry5HowToUseTapestryHibernate

------------------------------------------------------------------------------
  
  cd hb
  
- mvn jetty:run
+ mvn -Djetty.port=8080 jetty:run
     
  }}}
  
  open http://localhost:8080/hb/  in your browser, if you see 'hb Start Page' 
then proceed to step 2 otherwise fix the problems first.
+ (if you want another port use: {{{mvn -Djetty.port=8080 jetty:run}}} )
  
  === Step 2: ===
                 
@@ -33, +34 @@

                 
  ==== Hello.java ====
  {{{
- package org.example.hb;
+ package org.example.hb.entities;
  
  import javax.persistence.*;
  
@@ -59, +60 @@

  We can't compile this program yet as we need those hibernate's jar files.     
                                                           
                                                                         
  === Step 3: ===
- 
+ '''a)'''[[BR]]
-       This procedure depends on IDE used, the main goal is to make hibernate 
jar file available to our project, in my case I create a hibernateLib directory 
which contains following jar files:  
+ This procedure depends on IDE used, the main goal is to make hibernate jar 
file available to our project, in my case I create a hibernateLib directory 
which contains following jar files:  
   
  {{{  
        antlr-2.7.6.jar                         commons-logging-1.0.4.jar       
        hsqldb.jar                                      
tapestry-hibernate-5.0.5.jar
@@ -71, +72 @@

        commons-collections-2.1.1.jar           hibernate3.jar                  
        tapestry-core-5.0.5.jar
  }}}   
        some of jar files are duplicates of Tapestry 5, you can exclude them, 
so find a way in your IDE to add those jar files to the project, then compile, 
if no error found proceed to Step 4.
+ 
+ '''b)'''[[BR]]
+ if maven is integrated int your IDE (mvneclipse...) just add this to your pom
+ {{{
+     <dependency>
+       <groupId>org.apache.tapestry</groupId>
+       <artifactId>tapestry-hibernate</artifactId>
+       <version>${tapestry-release-version}</version>
+     </dependency>
+     <dependency>
+       <groupId>org.hibernate</groupId>
+       <artifactId>hibernate</artifactId>
+       <version>3.2.2.ga</version>
+     </dependency>
+       <dependency>
+               <groupId>c3p0</groupId>
+               <artifactId>c3p0</artifactId>
+               <version>0.9.0</version>
+       </dependency>
+     <dependency>
+       <groupId>geronimo-spec</groupId>
+       <artifactId>geronimo-spec-jta</artifactId>
+       <version>1.0-M1</version>
+       <scope>test</scope>
+     </dependency>
+     <dependency>
+       <groupId>org.hibernate</groupId>
+       <artifactId>hibernate-annotations</artifactId>
+       <version>3.2.1.ga</version>
+     </dependency>
+     <dependency>
+       <groupId>mysql</groupId>
+       <artifactId>mysql-connector-java</artifactId>
+       <version>3.1.12</version>
+     </dependency>
+ 
+ }}}
        
  === Step 4: ===
  
@@ -104, +142 @@

            </session-factory>
        </hibernate-configuration>
  }}}   
+       '''Note:''' for Intellij if you get error : "Could not parse 
configuration" try removing "<?xml.." line from config
        '''Note:''' for Intellij IDEA user, if you encounter a notification 
that 'New Hibernate Facet detected', just choose 'Remove Hibernate and don't 
detect Hibernate Facets in module', this will make our tutorial simple.
        
        Try to compile and run the program, for running it's IDE specific, you 
need to configure something to run it under Tomcat. if everything is fine at 
this point, let's proceed to step 5 to use Tapestry-Hibernate feature
@@ -152, +191 @@

            }
        }
  }}}
-         
+ 
+ Also add HBAction.htm in webapp/WEB-INF/
+ {{{
+ <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>
+     <head>
+         <title>Hibernate example app</title>
+     </head>
+     <body>
+     </body>
+ </html>
+ }}}     
        Compile and deploy the application, first try this command to add a 
record:
        
        http://localhost:8080/HbAction/add   

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to