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.com>wrote:

> > 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>
> >        <groupId>org.apache.tapestry</groupId>
> >        <artifactId>tapestry-hibernate</artifactId>
> >        <version>${tapestry-release-version}</version>
> >    </dependency>
> >
> >    <dependency>
> >        <groupId>org.hibernate</groupId>
> >        <artifactId>hibernate-core</artifactId>
> >        <version>3.6.0.Final</version>
> >    </dependency>
> >    <dependency>
> >        <groupId>net.sf.ehcache</groupId>
> >        <artifactId>ehcache-core</artifactId>
> >        <version>2.2.0</version>
> >    </dependency>
> >    <dependency>
> >        <groupId>mysql</groupId>
> >        <artifactId>mysql-connector-java</artifactId>
> >        <version>5.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 List<Address> 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>
> >    <session-factory>
> >        <property
> > name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
> >        <property
> >
> name="hibernate.connection.url">jdbc:mysql://localhost:3306/tapestryboard</property>
> >        <property
> > name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
> >        <property name="hibernate.connection.username">root</property>
> >        <property name="hibernate.connection.password"></property>
> >        <property name="hbm2ddl.auto">update</property>
> >        <property name="hibernate.show_sql">true</property>
> >        <property name="hibernate.format_sql">true</property>
> >
> >
> >    </session-factory>
> > </hibernate-configuration>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


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

Reply via email to