Re: Q: Tapestry 5.2.4 + Hibernate 3.6 ?

2011-02-26 Thread dwi ardi irawan
As of Hibernate 3.6, JDK 1.4 support has been dropped and the Hibernate
Annotations have been merged back into Core.
Then why should I need hibernate annotations on my pom.xml ??


On Sat, Feb 26, 2011 at 2:03 AM, Josh Canfield joshcanfi...@gmail.comwrote:

  Could not initialize class
  org.hibernate.annotations.common.reflection.java.JavaReflectionManager

 It looks like you need to add a dependency to hibernate annotations.

 Josh

 On Fri, Feb 25, 2011 at 10:26 AM, dwi ardi irawan
 penyihirke...@gmail.com wrote:
  I'm using Tapestry 5.2.4 and Hibernate 3.6
 
  These are the steps in my Tapestry-Hibernate
  I just want to display an address table.
 
  But I got an error:
  Exception constructing service 'ValueEncoderSource': Error invoking
 service
  builder method
  org.apache.tapestry5.services.TapestryModule.buildValueEncoderSource(Map,
  InvalidationEventHub)
  (at TapestryModule.java:2287) (for service 'ValueEncoderSource'): Error
  invoking service contribution method
 
 org.apache.tapestry5.hibernate.HibernateModule.contributeValueEncoderSource(MappedConfiguration,
 
  boolean, HibernateSessionSource, Session, TypeCoercer, PropertyAccess,
  LoggerSource): Exception constructing service 'HibernateSessionSource':
  Error invoking service builder method
 
 org.apache.tapestry5.hibernate.HibernateCoreModule.buildHibernateSessionSource(Logger,
 
  List, RegistryShutdownHub) (at HibernateCoreModule.java:123) (for service
  'HibernateSessionSource'):
  Could not initialize class
  org.hibernate.annotations.common.reflection.java.JavaReflectionManager
 
  My questions are:
  1. Did I miss something to configure
  2. How did tapestry load hibernate.cfg.xml for the first time?
  3. Most of the example out there is using tapestry 5.1 and Hibernate 
 3.6
  version
 
  Could anyone help me, please
 
  *STEP BY STEP :
 
  **1. pom.xml*
 
  I added :
 dependency
 groupIdorg.apache.tapestry/groupId
 artifactIdtapestry-hibernate/artifactId
 version${tapestry-release-version}/version
 /dependency
 
 dependency
 groupIdorg.hibernate/groupId
 artifactIdhibernate-core/artifactId
 version3.6.0.Final/version
 /dependency
 dependency
 groupIdnet.sf.ehcache/groupId
 artifactIdehcache-core/artifactId
 version2.2.0/version
 /dependency
 dependency
 groupIdmysql/groupId
 artifactIdmysql-connector-java/artifactId
 version5.1.15/version
 /dependency
 
  *2. Address.java*
 
  import javax.persistence.Entity;
  import javax.persistence.GeneratedValue;
  import javax.persistence.GenerationType;
  import javax.persistence.Id;
  import javax.persistence.Table;
 
  import org.apache.tapestry5.beaneditor.NonVisual;
  import org.apache.tapestry5.beaneditor.Validate;
 
  @Entity
  @Table(name=hello)
  public class Address {
 @Id
 @GeneratedValue(strategy = GenerationType.IDENTITY)
 @NonVisual
 
 private Long id;
 
 @Validate(required)
 private String firstName;
 
 private String lastName;
 private String street1;
 private String street2;
 
 @Validate(required)
 private String city;
 
 private String state;
 
 @Validate(required,regexp)
 private String zip;
 
 private String email;
 private String phone;
 
 public Long getId() {
 return id;
 }
 public void setId(Long id) {
 this.id = id;
 }
 
 public String getFirstName() {
 return firstName;
 }
 public void setFirstName(String firstName) {
 this.firstName = firstName;
 }
 
 public String getLastName() {
 return lastName;
 }
 public void setLastName(String lastName) {
 this.lastName = lastName;
 }
 
 public String getStreet1() {
 return street1;
 }
 public void setStreet1(String street1) {
 this.street1 = street1;
 }
 
 public String getStreet2() {
 return street2;
 }
 public void setStreet2(String street2) {
 this.street2 = street2;
 }
 
 public String getCity() {
 return city;
 }
 public void setCity(String city) {
 this.city = city;
 }
 
 public String getState() {
 return state;
 }
 public void setState(String state) {
 this.state = state;
 }
 
 public String getZip() {
 return zip;
 }
 public void setZip(String zip) {
 this.zip = zip;
 }
 
 public String getEmail() {
 return email;
 }
 public void setEmail(String email) {
 this.email = email;
 }
 
 public String getPhone() {
 return phone;
 }
 public void setPhone(String phone) {
 this.phone = phone;
 }
 
  }
 
  *3. HibernateExamplePage.tml*
 
  t:grid source=addresses/
 
  *4. HibernateExamplePage.java*
 
  import org.apache.tapestry5.ioc.annotations.Inject;
  import org.hibernate.Session;
  import 

Re: Q: Tapestry 5.2.4 + Hibernate 3.6 ?

2011-02-26 Thread Thiago H. de Paula Figueiredo
On Sat, 26 Feb 2011 09:52:40 -0300, dwi ardi irawan  
penyihirke...@gmail.com wrote:



As of Hibernate 3.6, JDK 1.4 support has been dropped and the Hibernate
Annotations have been merged back into Core.
Then why should I need hibernate annotations on my pom.xml ??


You shouldn't. Have you checked if the Hibernate JAR was correctly  
downloaded and if you have two different Hibernate versions in the  
classpath? A corrupted or truncated JAR can cause strange problems.


--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor

Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: Q: Tapestry 5.2.4 + Hibernate 3.6 ?

2011-02-26 Thread dwi ardi irawan
Yes, I've checked it. And it doesn't corrupt at all.
I think the problem is in the jetty launcher, cos when use mvn jetty:run, it
doesn't show any error
Strange 

but now there is another problem, now, the page is show:
There is no data to display.

my table has only 1 row.


On Sat, Feb 26, 2011 at 10:07 PM, Thiago H. de Paula Figueiredo 
thiag...@gmail.com wrote:

 On Sat, 26 Feb 2011 09:52:40 -0300, dwi ardi irawan 
 penyihirke...@gmail.com wrote:

  As of Hibernate 3.6, JDK 1.4 support has been dropped and the Hibernate
 Annotations have been merged back into Core.
 Then why should I need hibernate annotations on my pom.xml ??


 You shouldn't. Have you checked if the Hibernate JAR was correctly
 downloaded and if you have two different Hibernate versions in the
 classpath? A corrupted or truncated JAR can cause strange problems.

 --
 Thiago H. de Paula Figueiredo
 Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
 and instructor
 Owner, Ars Machina Tecnologia da Informação Ltda.
 http://www.arsmachina.com.br




-- 
http://dwiardiirawan.com
cos everyone could be extraordinary...lighten up !


Re: Q: Tapestry 5.2.4 + Hibernate 3.6 ?

2011-02-26 Thread dwi ardi irawan
Yay. I got it works !
I forgot to mapped the beans entity on my hibernate configuration

hibernate-configuration
session-factory
property
name=hibernate.connection.driver_classcom.mysql.jdbc.Driver/property
property
name=hibernate.connection.urljdbc:mysql://localhost:3306/tapestryboard/property
property
name=hibernate.dialectorg.hibernate.dialect.MySQLDialect/property
property name=hibernate.connection.usernameroot/property
property name=hibernate.connection.password/property
property name=hbm2ddl.autoupdate/property
property name=hibernate.show_sqltrue/property
property name=hibernate.format_sqltrue/property

mapping class=org.makeasoup.hibernateboard.beans.Address/

/session-factory
/hibernate-configuration

Thnx guys ^^,

On Sat, Feb 26, 2011 at 11:29 PM, dwi ardi irawan
penyihirke...@gmail.comwrote:

 here is my source code 
 so it doesn't show an error like it did previously
 but I have to you mvn jetty:run instead of using jetty launcher.

 but now, it show : There is no data to display

 could anyone help me?


 On Sat, Feb 26, 2011 at 11:17 PM, dwi ardi irawan penyihirke...@gmail.com
  wrote:

 Yes, I've checked it. And it doesn't corrupt at all.
 I think the problem is in the jetty launcher, cos when use mvn jetty:run,
 it doesn't show any error
 Strange 

 but now there is another problem, now, the page is show:
 There is no data to display.

 my table has only 1 row.



 On Sat, Feb 26, 2011 at 10:07 PM, Thiago H. de Paula Figueiredo 
 thiag...@gmail.com wrote:

 On Sat, 26 Feb 2011 09:52:40 -0300, dwi ardi irawan 
 penyihirke...@gmail.com wrote:

  As of Hibernate 3.6, JDK 1.4 support has been dropped and the Hibernate
 Annotations have been merged back into Core.
 Then why should I need hibernate annotations on my pom.xml ??


 You shouldn't. Have you checked if the Hibernate JAR was correctly
 downloaded and if you have two different Hibernate versions in the
 classpath? A corrupted or truncated JAR can cause strange problems.

 --
 Thiago H. de Paula Figueiredo
 Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
 and instructor
 Owner, Ars Machina Tecnologia da Informação Ltda.
 http://www.arsmachina.com.br




 --
 http://dwiardiirawan.com
 cos everyone could be extraordinary...lighten up !




 --
 http://dwiardiirawan.com
 cos everyone could be extraordinary...lighten up !




-- 
http://dwiardiirawan.com
cos everyone could be extraordinary...lighten up !


Re: Q: Tapestry 5.2.4 + Hibernate 3.6 ?

2011-02-26 Thread dwi ardi irawan
One more question why it still show this error if I use jetty launcher(It
works fine if I use mvn jetty:run)

*Exception constructing service 'ValueEncoderSource': Error invoking service
builder method
org.apache.tapestry5.services.TapestryModule.buildValueEncoderSource(Map,
InvalidationEventHub) (at TapestryModule.java:2287) (for service
'ValueEncoderSource'): Error invoking service contribution method
org.apache.tapestry5.hibernate.HibernateModule.contributeValueEncoderSource(MappedConfiguration,
boolean, HibernateSessionSource, Session, TypeCoercer, PropertyAccess,
LoggerSource): Exception constructing service 'HibernateSessionSource':
Error invoking service builder method
org.apache.tapestry5.hibernate.HibernateCoreModule.buildHibernateSessionSource(Logger,
List, RegistryShutdownHub) (at HibernateCoreModule.java:123) (for service
'HibernateSessionSource'): Could not initialize class
org.hibernate.annotations.common.reflection.java.JavaReflectionManager*


On Sun, Feb 27, 2011 at 2:32 AM, dwi ardi irawan penyihirke...@gmail.comwrote:

 Yay. I got it works !
 I forgot to mapped the beans entity on my hibernate configuration


 hibernate-configuration
 session-factory
 property
 name=hibernate.connection.driver_classcom.mysql.jdbc.Driver/property
 property
 name=hibernate.connection.urljdbc:mysql://localhost:3306/tapestryboard/property
 property
 name=hibernate.dialectorg.hibernate.dialect.MySQLDialect/property
 property name=hibernate.connection.usernameroot/property
 property name=hibernate.connection.password/property
 property name=hbm2ddl.autoupdate/property
 property name=hibernate.show_sqltrue/property
 property name=hibernate.format_sqltrue/property

 mapping class=org.makeasoup.hibernateboard.beans.Address/

 /session-factory
 /hibernate-configuration

 Thnx guys ^^,


 On Sat, Feb 26, 2011 at 11:29 PM, dwi ardi irawan penyihirke...@gmail.com
  wrote:

 here is my source code 
 so it doesn't show an error like it did previously
 but I have to you mvn jetty:run instead of using jetty launcher.

 but now, it show : There is no data to display

 could anyone help me?


 On Sat, Feb 26, 2011 at 11:17 PM, dwi ardi irawan 
 penyihirke...@gmail.com wrote:

 Yes, I've checked it. And it doesn't corrupt at all.
 I think the problem is in the jetty launcher, cos when use mvn jetty:run,
 it doesn't show any error
 Strange 

 but now there is another problem, now, the page is show:
 There is no data to display.

 my table has only 1 row.



 On Sat, Feb 26, 2011 at 10:07 PM, Thiago H. de Paula Figueiredo 
 thiag...@gmail.com wrote:

 On Sat, 26 Feb 2011 09:52:40 -0300, dwi ardi irawan 
 penyihirke...@gmail.com wrote:

  As of Hibernate 3.6, JDK 1.4 support has been dropped and the Hibernate
 Annotations have been merged back into Core.
 Then why should I need hibernate annotations on my pom.xml ??


 You shouldn't. Have you checked if the Hibernate JAR was correctly
 downloaded and if you have two different Hibernate versions in the
 classpath? A corrupted or truncated JAR can cause strange problems.

 --
 Thiago H. de Paula Figueiredo
 Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
 and instructor
 Owner, Ars Machina Tecnologia da Informação Ltda.
 http://www.arsmachina.com.br




 --
 http://dwiardiirawan.com
 cos everyone could be extraordinary...lighten up !




 --
 http://dwiardiirawan.com
 cos everyone could be extraordinary...lighten up !




 --
 http://dwiardiirawan.com
 cos everyone could be extraordinary...lighten up !




-- 
http://dwiardiirawan.com
cos everyone could be extraordinary...lighten up !


Re: Q: Tapestry 5.2.4 + Hibernate 3.6 ?

2011-02-25 Thread Josh Canfield
 Could not initialize class
 org.hibernate.annotations.common.reflection.java.JavaReflectionManager

It looks like you need to add a dependency to hibernate annotations.

Josh

On Fri, Feb 25, 2011 at 10:26 AM, dwi ardi irawan
penyihirke...@gmail.com wrote:
 I'm using Tapestry 5.2.4 and Hibernate 3.6

 These are the steps in my Tapestry-Hibernate
 I just want to display an address table.

 But I got an error:
 Exception constructing service 'ValueEncoderSource': Error invoking service
 builder method
 org.apache.tapestry5.services.TapestryModule.buildValueEncoderSource(Map,
 InvalidationEventHub)
 (at TapestryModule.java:2287) (for service 'ValueEncoderSource'): Error
 invoking service contribution method
 org.apache.tapestry5.hibernate.HibernateModule.contributeValueEncoderSource(MappedConfiguration,

 boolean, HibernateSessionSource, Session, TypeCoercer, PropertyAccess,
 LoggerSource): Exception constructing service 'HibernateSessionSource':
 Error invoking service builder method
 org.apache.tapestry5.hibernate.HibernateCoreModule.buildHibernateSessionSource(Logger,

 List, RegistryShutdownHub) (at HibernateCoreModule.java:123) (for service
 'HibernateSessionSource'):
 Could not initialize class
 org.hibernate.annotations.common.reflection.java.JavaReflectionManager

 My questions are:
 1. Did I miss something to configure
 2. How did tapestry load hibernate.cfg.xml for the first time?
 3. Most of the example out there is using tapestry 5.1 and Hibernate  3.6
 version

 Could anyone help me, please

 *STEP BY STEP :

 **1. pom.xml*

 I added :
    dependency
        groupIdorg.apache.tapestry/groupId
        artifactIdtapestry-hibernate/artifactId
        version${tapestry-release-version}/version
    /dependency

    dependency
        groupIdorg.hibernate/groupId
        artifactIdhibernate-core/artifactId
        version3.6.0.Final/version
    /dependency
    dependency
        groupIdnet.sf.ehcache/groupId
        artifactIdehcache-core/artifactId
        version2.2.0/version
    /dependency
    dependency
        groupIdmysql/groupId
        artifactIdmysql-connector-java/artifactId
        version5.1.15/version
    /dependency

 *2. Address.java*

 import javax.persistence.Entity;
 import javax.persistence.GeneratedValue;
 import javax.persistence.GenerationType;
 import javax.persistence.Id;
 import javax.persistence.Table;

 import org.apache.tapestry5.beaneditor.NonVisual;
 import org.apache.tapestry5.beaneditor.Validate;

 @Entity
 @Table(name=hello)
 public class Address {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @NonVisual

    private Long id;

    @Validate(required)
    private String firstName;

    private String lastName;
    private String street1;
    private String street2;

    @Validate(required)
    private String city;

    private String state;

    @Validate(required,regexp)
    private String zip;

    private String email;
    private String phone;

    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }

    public String getFirstName() {
        return firstName;
    }
    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getLastName() {
        return lastName;
    }
    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    public String getStreet1() {
        return street1;
    }
    public void setStreet1(String street1) {
        this.street1 = street1;
    }

    public String getStreet2() {
        return street2;
    }
    public void setStreet2(String street2) {
        this.street2 = street2;
    }

    public String getCity() {
        return city;
    }
    public void setCity(String city) {
        this.city = city;
    }

    public String getState() {
        return state;
    }
    public void setState(String state) {
        this.state = state;
    }

    public String getZip() {
        return zip;
    }
    public void setZip(String zip) {
        this.zip = zip;
    }

    public String getEmail() {
        return email;
    }
    public void setEmail(String email) {
        this.email = email;
    }

    public String getPhone() {
        return phone;
    }
    public void setPhone(String phone) {
        this.phone = phone;
    }

 }

 *3. HibernateExamplePage.tml*

 t:grid source=addresses/

 *4. HibernateExamplePage.java*

 import org.apache.tapestry5.ioc.annotations.Inject;
 import org.hibernate.Session;
 import org.makeasoup.tapestryboard.beans.Address;

 public class HibernatePage {
    @Inject
    private Session session;

    public ListAddress getAddresses()
    {
        return session.createCriteria(Address.class).list();
    }

 }

 *5. Hibernate.cfg.xml*

 !DOCTYPE hibernate-configuration PUBLIC
        -//Hibernate/Hibernate Configuration DTD 3.0//EN
        http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd;
 hibernate-configuration