Hi,

i am playing with JPA, but there is no useful information about that. A simple example to display a database table.

The entities class is in the right package entities. I did not added something to the AppModule class. The persistence.xml exists.

Customer.tml

<html t:type="layout" title="Customer"
      xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd";
      xmlns:p="tapestry:parameter">
  <table t:type="grid" source="customers"/>
</html>


Customers.class

public class Customers {

  @Property
  private Customer customer;
  private EntityManagerFactory factory;
  private EntityManager entityManager;
  @Inject
  private Logger logger;
  @Inject
  private BeanModelSource beanModelSource;
  @Inject
  private Messages messages;

  @Log
  public List<Customers> getCustomers() {
factory = Persistence.createEntityManagerFactory("de.aeits_TapestryWeb_war_1.0-SNAPSHOTPU");
    entityManager = factory.createEntityManager();
return entityManager.createNamedQuery("Customer.findAll").getResultList();
  }
}


What about the DAO and DAOImpl there are no informations how to use this classes with a simple query page.

In all docus i found only 'entityManager.createNamedQuery("Customer.findAll").getResultList();' is needed, but i get a null pointer expection.

Thanks
Andreas
--
ae | Andreas Ernst | IT Spektrum
Postfach 5, 65612 Beselich
Schupbacher Str. 32, 65614 Beselich, Germany
Tel: +49-6484-91002 Fax: +49-6484-91003
a...@ae-online.de | www.ae-online.de
www.tachyon-online.de

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

Reply via email to