title: hibernate doesn't see a setter
body: <p>I am new to hibernate and I have stupid problem. My files: </p>
  
  <p>hibernate.cfg.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;!DOCTYPE hibernate-configuration SYSTEM "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"&gt;
  &lt;hibernate-configuration&gt;
      &lt;session-factory&gt;
          &lt;property name="hibernate.dialect"&gt;
              org.hibernate.dialect.PostgreSQLDialect
          &lt;/property&gt;
          &lt;property name="hibernate.connection.driver_class"&gt;
              org.postgresql.Driver
          &lt;/property&gt;
          &lt;!-- Assume test is the database name --&gt;
          &lt;property name="hibernate.connection.url"&gt;
              jdbc:postgresql://localhost/booktown
          &lt;/property&gt;
          &lt;property name="hibernate.connection.username"&gt;
              mirek
          &lt;/property&gt;
          &lt;mapping resource="Books.hbm.xml"/&gt;
      &lt;/session-factory&gt;
  &lt;/hibernate-configuration&gt;
  </code></pre>
  
  <p>books.hbm.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"&gt;
  &lt;hibernate-mapping&gt;
      &lt;class name="Books" table="books"&gt;
          &lt;meta attribute="Książki w booktown"&gt;
              This class contains the employee detail.
          &lt;/meta&gt;
          &lt;id name="id" type="int" column="id"&gt;
              &lt;generator class="native"/&gt;
          &lt;/id&gt;
          &lt;property name="title" column="title" type="string"/&gt;
          &lt;property name="author_id" column="author_id" type="int"/&gt;
          &lt;property name="subject_id" column="subject_id" type="int"/&gt;
      &lt;/class&gt;
  &lt;/hibernate-mapping&gt;
  </code></pre>
  
  <p>Books.java</p>
  
  <pre><code>public class Books
  {
      private int id;
      private String title;
      private int author_id;
      private int subject_id;
  
      public Books(String title, int author_id, int subject_id)
      {
          this.title = title;
          this.author_id = author_id;
          this.subject_id = subject_id;
      }
  
      public void setId(int id)
      {
          this.id = id;
      }
  
      public void setTitle(String title)
      {
          this.title = title;
      }
  
      public void setAuthorId(int author_id)
      {
          this.author_id = author_id;
      }
  
      public void setSubjectId(int subject_id)
      {
          this.subject_id = subject_id;
      }
  
      public int getId()
      {
          return id;
      }
  
      public String getTitle()
      {
          return title;
      }
  
      public int getAuthorId()
      {
          return author_id;
      }
  
      public int getSubjectId()
      {
          return subject_id;
      }
  }
  </code></pre>
  
  <p>and Booktown.java</p>
  
  <pre><code>import java.util.Iterator;
  import java.util.List;
  import org.hibernate.HibernateException;
  import org.hibernate.Session;
  import org.hibernate.SessionFactory;
  import org.hibernate.Transaction;
  import org.hibernate.cfg.Configuration;
  import org.hibernate.service.ServiceRegistry;
  import org.hibernate.service.ServiceRegistryBuilder;
  
  public class Booktown
  {
      private static SessionFactory factory;
      private static ServiceRegistry serviceRegistry;
  
      public static void main(String[] args)
      {
          try
          {
              //private static SessionFactory configureSessionFactory() throws HibernateException {
                  Configuration configuration = new Configuration();
                  configuration.configure();
                  serviceRegistry = new ServiceRegistryBuilder().applySettings(configuration.getProperties()).buildServiceRegistry();        
                  factory = configuration.buildSessionFactory(serviceRegistry);
                  //return factory;
  
  
              //factory = new Configuration().configure().buildSessionFactory();
          }
          catch (Throwable ex)
          {
              System.err.println("Failed to create sessionFactory object." + ex.toString());
              throw new ExceptionInInitializerError(ex);
          }
  
          Booktown BT = new Booktown();
          /* Add few employee records in database */
          Integer bID1 = BT.addBook(10, "Jakiś napis", 10, 30);
          Integer bID2 = BT.addBook(20, "Jakiś inny napis", 10, 50);
          //Integer bID3 = BT.addBook(30, "John", 10000, 14);
          /* List down all the employees */
          BT.listBooks();
          /* Update employee's records */
          BT.updateBook(bID1, 5000);
          /* Delete an employee from the database */
          BT.deleteBook(bID2);
          /* List down new list of the employees */
          BT.listBooks();
      }
  
      /* Method to CREATE a book in the database */
      public Integer addBook(int bid, String fname, int lname, int salary)
      {
          Session session = factory.openSession();
          Transaction tx = null;
          Integer bID = null;
          try
          {
              tx = session.beginTransaction();
              Books book = new Books(fname, lname, salary);
              bid = (Integer) session.save(book);
              tx.commit();
          }
          catch (HibernateException e)
          {
              if (tx != null)
                  tx.rollback();
              e.printStackTrace();
          }
          finally
          {
              session.close();
          }
          return bID;
      }
  
      /* Method to READ all the books */
      public void listBooks()
      {
          Session session = factory.openSession();
          Transaction tx = null;
          try
          {
              tx = session.beginTransaction();
              List&lt;Books&gt; books = session.createQuery("FROM books").list();
              for (Iterator&lt;Books&gt; iterator = books.iterator(); iterator.hasNext();)
              {
                  Books book = (Books) iterator.next();
                  System.out.print("First Name: " + book.getTitle());
                  System.out.print(" Last Name: " + book.getAuthorId());
                  System.out.println(" Salary: " + book.getSubjectId());
              }
              tx.commit();
          }
          catch (HibernateException e)
          {
              if (tx != null)
                  tx.rollback();
              e.printStackTrace();
          }
          finally
          {
              session.close();
          }
      }
  
      /* Method to UPDATE author for a book */
      public void updateBook(Integer bID, int auth)
      {
          Session session = factory.openSession();
          Transaction tx = null;
          try
          {
              tx = session.beginTransaction();
              Books book = (Books) session.get(Books.class, bID);
              book.setAuthorId(auth);
              session.update(book);
              tx.commit();
          }
          catch (HibernateException e)
          {
              if (tx != null)
                  tx.rollback();
              e.printStackTrace();
          }
          finally
          {
              session.close();
          }
      }
  
      /* Method to DELETE a book from the records */
      public void deleteBook(Integer bID)
      {
          Session session = factory.openSession();
          Transaction tx = null;
          try
          {
              tx = session.beginTransaction();
              Books book = (Books) session.get(Books.class, bID);
              session.delete(book);
              tx.commit();
          }
          catch (HibernateException e)
          {
              if (tx != null)
                  tx.rollback();
              e.printStackTrace();
          }
          finally
          {
              session.close();
          }
      }
  }
  </code></pre>
  
  <p>Code is compiling but at run I get:</p>
  
  <pre><code>&gt; paź 15, 2013 8:44:38 PM org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory   &lt;init&gt;
  INFO: HHH000397: Using ASTQueryTranslatorFactory
  Failed to create sessionFactory object.org.hibernate.MappingException: Could not get   constructor for org.hibernate.persister.entity.SingleTableEntityPersister
  Exception in thread "main" java.lang.ExceptionInInitializerError
  at Booktown.main(Booktown.java:34)
  Caused by: org.hibernate.MappingException: Could not get constructor for  org.hibernate.persister.entity.SingleTableEntityPersister
  at   org.hibernate.persister.internal.PersisterFactoryImpl.create(PersisterFactoryImpl.java:185)
  at org.hibernate.persister.internal.PersisterFactoryImpl.createEntityPersister(PersisterFactoryImpl.java:135)
  at org.hibernate.internal.SessionFactoryImpl.&lt;init&gt;(SessionFactoryImpl.java:385)
  at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1790)
  at Booktown.main(Booktown.java:25)
  Caused by: org.hibernate.HibernateException: Unable to instantiate default tuplizer   [org.hibernate.tuple.entity.PojoEntityTuplizer]
  at  org.hibernate.tuple.entity.EntityTuplizerFactory.constructTuplizer(EntityTuplizerFactory.java:138)
  at   org.hibernate.tuple.entity.EntityTuplizerFactory.constructDefaultTuplizer(EntityTuplizerFactory.java:188)
  at org.hibernate.tuple.entity.EntityMetamodel.&lt;init&gt;(EntityMetamodel.java:341) at  org.hibernate.persister.entity.AbstractEntityPersister.&lt;init&gt;(AbstractEntityPersister.java:507)
  at org.hibernate.persister.entity.SingleTableEntityPersister.&lt;init&gt;(SingleTableEntityPersister.java:146)
  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  at  sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
  at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
  at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
  at  org.hibernate.persister.internal.PersisterFactoryImpl.create(PersisterFactoryImpl.java:163)
  ... 4 more
  Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
  at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
  at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
  at  org.hibernate.tuple.entity.EntityTuplizerFactory.constructTuplizer(EntityTuplizerFactory.java:135)
  ... 13 more
  Caused by: org.hibernate.PropertyNotFoundException: Could not find a getter for author_id in class Books
  at org.hibernate.property.BasicPropertyAccessor.createGetter(BasicPropertyAccessor.java:316)
  at org.hibernate.property.BasicPropertyAccessor.getGetter(BasicPropertyAccessor.java:310)
  at org.hibernate.mapping.Property.getGetter(Property.java:321)
  at org.hibernate.tuple.entity.PojoEntityTuplizer.buildPropertyGetter(PojoEntityTuplizer.java:444)
  at org.hibernate.tuple.entity.AbstractEntityTuplizer.&lt;init&gt;(AbstractEntityTuplizer.java:200)
  at org.hibernate.tuple.entity.PojoEntityTuplizer.&lt;init&gt;(PojoEntityTuplizer.java:82)
  ... 18 more
  </code></pre>
  
  <p>I found similar problem there was no setter. In my case system says that there is no getter for author_id but it is at line 45 in Books.java. </p>
  
  <p>Could sb tells me what is wrong? Maybe there is an other cause which I don't see...</p>