Hello
Earlier I was working in swing but now I need to create RIA app, so I decided to try vaadin because making gui look more like desktop app.
Anyway after long search best way to integrate hibernate and vaadin and not fiding any good solution I give up that idea and decided to try app foundation adon, and here are my problem:
- I creating new project with vaadin plugin for eclipse
- copying: appfoundation.jar, eclipselink.jar, javax.persistence_1.0.0.jar, javax.persistence_2.0_preview.jar, postgresql-8.3-605.jdbc4.jar, vaadin-6.4.0.jar, xom-1.2.6.jar
into Myapp->WebContent->WEB-INF->lib - Creating persistence.xml under Myapp->src->META-INF
And filling it with folowing content
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0"
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_1_0.xsd">
<persistence-unit name="default">
<provider>
org.eclipse.persistence.jpa.PersistenceProvider
</provider>
<class>myapp.Producer</class>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="eclipselink.logging.level" value="FINE" />
<property name="eclipselink.jdbc.driver" value="org.postgresql.Driver" />
<property name="eclipselink.jdbc.url" value="jdbc:postgresql://localhost:5432/mydb" />
<property name="eclipselink.jdbc.user" value="user" />
<property name="eclipselink.jdbc.password" value="pass" />
<property name="eclipselink.ddl-generation" value="none" />
<property name="eclipselink.ddl-generation.output-mode"
value="database" />
<property name="eclipselink.orm.throw.exceptions" value="true" />
</properties>
</persistence-unit>
</persistence>
- i extend my entity class with extends AbstractPojo
- Creating class
MyappContextListener.java
package myapp;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import org.vaadin.appfoundation.persistence.facade.FacadeFactory;
public class MyappContextListener implements ServletContextListener {
public void contextDestroyed(ServletContextEvent arg0) {
// TODO Auto-generated method stub
}
public void contextInitialized(ServletContextEvent arg0) {
// Setup and register the facade
try {
FacadeFactory.registerFacade("default", true);
} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
- next I add
<listener>
<listener-class>
myapp.MyappContextListener</listener-class>
</listener>
to web.xml
- finally trying get data from database with
List<Producer> producer = FacadeFactory.getFacade().list(Producer.class);
String producersList = "";
for(Producer p : producer){
producersList += p.getSname();
}
- Deploying application on jboss and…
21:07:17,375 ERROR [AbstractKernelController]
Error installing to Start: name=persistence.unit:unitName=#default state=Create
java.lang.RuntimeException: Specification violation [EJB3 JPA 6.2.1.2]
- You have not defined a jta-data-source for a JTA enabled persistence context named: default
What i do wrong?