2 Replies Latest reply on Mar 8, 2005 1:18 PM by bill.burke

    @Version bug with access=FIELD ?

    mwelss

      The following code throws an exception during deployment:

      package demo;
      
      import java.util.Date;
      import javax.persistence.*;
      
      @Entity(access=AccessType.FIELD)
      public class Person {
      
       @Id(generate = GeneratorType.AUTO)
       protected Long id;
       protected String name;
       protected String address;
       protected Date birthday;
       @Version
       protected Long version;
      
       public Person() {
       }
      
      
      }
      


      The beginning of the exception stack is:

      org.hibernate.PropertyNotFoundException: Could not find a getter for version in class demo.Person
      at org.hibernate.property.BasicPropertyAccessor.createGetter(BasicPropertyAccessor.java:207)
      at org.hibernate.property.BasicPropertyAccessor.getGetter(BasicPropertyAccessor.java:201)
      at org.hibernate.mapping.Property.getGetter(Property.java:161)
      at org.hibernate.persister.AbstractEntityPersister.<init>(AbstractEntityPersister.java:306)
      at org.hibernate.persister.BasicEntityPersister.<init>(BasicEntityPersister.java:352)
      at org.hibernate.persister.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:95)
      at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:44)
      at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:194)
      at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1003)
      at org.jboss.ejb3.entity.HibernateSessionFactory.createSessionFactory(HibernateSessionFactory.java:160)
      at org.jboss.ejb3.Ejb3Module.createHibernateSessionFactory(Ejb3Module.java:252)
      at org.jboss.ejb3.Ejb3Module.startService(Ejb3Module.java:264)


      Sine it works with @Id I would except it to work with @Version, too??

      regards

      Martin