Cutting to the case.
Persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="fishsticks" transaction-type="RESOURCE_LOCAL">
<class>model.Customer</class>
<etc etc>
<properties>
<property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" />
<property name="javax.persistence.jdbc.url" value="jdbc:mysql://127.0.0.1:3306/fishsticks" />
<property name="javax.persistence.jdbc.user" value="user" />
<property name="javax.persistence.jdbc.password" value="pass" />
<!-- EclipseLink should create the database schema automatically -->
<property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
<property name="eclipselink.ddl-generation.output-mode"
value="database" />
<property name="eclipselink.logging.level" value="OFF" />
</properties>
</persistence-unit>
</persistence>
Eclipse build path:
Project setup:
Error on my page: enter link description here
The page is made with jsp
And I have no idea how to fix this...
This is my DAO-file:
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.EntityTransaction;
import javax.persistence.Persistence;
import javax.persistence.PersistenceContext;
import model.Customer;
import model.Milestone;
import model.Project;
import model.Task;
import model.User;
public class JpaDAO implements DAO {
private static JpaDAO dao;
public static JpaDAO getInstance() {
if (dao == null)
dao = new JpaDAO();
return dao;
}
private EntityManagerFactory emf = Persistence.createEntityManagerFactory("fishsticks");
@PersistenceContext(name="fishsticksEM")
private EntityManager em = emf.createEntityManager();
private EntityTransaction tx = em.getTransaction();
private JpaDAO() {
// singleton
}
}