But heres the error message from EntityManagerFactory emfInstance = Persistence.createEntityManagerFactory("kunde");
Explicit persistence provider error(s) occurred for "kunde"
after trying the following discovered implementations:
org.datanucleus.api.jpa.PersistenceProviderImpl,
org.hibernate.ejb.HibernatePersistence from provider:
org.hibernate.ejb.HibernatePersistence
Am Freitag, 28. September 2012 10:26:54 UTC+2 schrieb Manuel:
Hey again,--
I still havent found a solution...
Heres one more Info:
I get warning when creating my EntityManagerFactory:
10:20:03,507 WARN [DataNucleus.MetaData] - Class de.mash.project.client.StaffView was specified in persistence-unit kunde but not annotated, so ignoring
10:20:03,507 WARN [DataNucleus.MetaData] - Class de.mash.project.client.AppController was specified in persistence-unit kunde but not annotated, so ignoring
10:20:03,507 WARN [DataNucleus.MetaData] - Class de.mash.project.client.MashService was specified in persistence-unit kunde but not annotated, so ignoring
10:20:03,507 WARN [DataNucleus.MetaData] - Class de.mash.project.server.MashServiceImpl was specified in persistence-unit kunde but not annotated, so ignoring
10:20:03,507 WARN [DataNucleus.MetaData] - Class de.mash.project.client.MainPage was specified in persistence-unit kunde but not annotated, so ignoring
10:20:03,507 WARN [DataNucleus.MetaData] - Class de.mash.project.shared.WorkerProxy was specified in persistence-unit kunde but not annotated, so ignoring
10:20:03,507 WARN [DataNucleus.MetaData] - Class de.mash.project.shared.WorkerRequestFactoryDeobfuscat orBuilder was specified in persistence-unit kunde but not annotated, so ignoring
10:20:03,507 WARN [DataNucleus.MetaData] - Class de.mash.project.client.presenter.Presenter was specified in persistence-unit kunde but not annotated, so ignoring
10:20:03,507 WARN [DataNucleus.MetaData] - Class de.mash.project.shared.ExpensesRequestFactoryDeobfusc atorBuilder was specified in persistence-unit kunde but not annotated, so ignoring
10:20:03,633 WARN [DataNucleus.MetaData] - Class de.mash.project.client.StockPrice was specified in persistence-unit kunde but not annotated, so ignoring
10:20:03,633 WARN [DataNucleus.MetaData] - Class de.mash.project.shared.ExpensesRequestFactory was specified in persistence-unit kunde but not annotated, so ignoring
10:20:03,633 WARN [DataNucleus.MetaData] - Class de.mash.project.shared.WorkerRequestFactory was specified in persistence-unit kunde but not annotated, so ignoring
10:20:03,633 WARN [DataNucleus.MetaData] - Class de.mash.project.client.MashServiceAsync was specified in persistence-unit kunde but not annotated, so ignoring
10:20:03,633 WARN [DataNucleus.MetaData] - Class de.mash.project.shared.WorkerRequest was specified in persistence-unit kunde but not annotated, so ignoring
10:20:03,633 WARN [DataNucleus.MetaData] - Class de.mash.project.client.TabContent was specified in persistence-unit kunde but not annotated, so ignoring
10:20:03,633 WARN [DataNucleus.MetaData] - Class de.mash.project.shared.EmployeeProxy was specified in persistence-unit kunde but not annotated, so ignoring
10:20:03,649 WARN [DataNucleus.MetaData] - Class de.mash.project.shared.FieldVerifier was specified in persistence-unit kunde but not annotated, so ignoring
10:20:03,649 WARN [DataNucleus.MetaData] - Class de.mash.project.server.EMF was specified in persistence-unit kunde but not annotated, so ignoring
10:20:03,649 WARN [DataNucleus.MetaData] - Class de.mash.project.shared.EmployeeRequest was specified in persistence-unit kunde but not annotated, so ignoring
So it looks like datanucleus is used instead of my db... tough i dont exactly know what this nucleus does.
I tried to disable it via project properties, but after that i had some errors inside my project because he deleted jars etc...
Am Freitag, 28. September 2012 02:26:45 UTC+2 schrieb Manuel:Hi everyone,
Actually I try to use GWT, Request Factory + JPA with Hibernate.
It seems to be working, but there is no data in my local database.
I can create a EntityMangerFactory
private static final EntityManagerFactory emfInstance = Persistence.createEntityManagerFactory(" kunde");[/code]
a EntityManger
EMF.createEntityManager()
and persists a Object
em.persist(Worker);
I can also read all my persisted Objects.
But I dont know where the data is saved. I thought, it should be saved in the postgresDB I configured in my persistence.xml?
Any help is much appreciated.
Thanks in advanced.
Regards,
Manuel
Here is my Code, please let me know if you need any further information.
My Entity Class
package de.mash.project.server;
import java.util.List;
import javax.jdo.annotations.Transactional;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityManager;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
@Entity
@Table(name = "Worker")
public class Worker {
public static Worker findWorker(Long id) {
// if (id == 0) {
return null;
// }
// EntityManager em = entityManager();
// try {
// Worker worker = em.find(Worker.class, id);
// return worker;
// } finally {
// em.close();
// }
}
@Transient
protected Object[] jdoDetachedState;
// @Id
// @GeneratedValue(generator = "auto_increment")
// @GenericGenerator(name = "auto_increment", strategy = "increment")
// @Column(name = "id")
// private int id;
@Id
@Column(name = "id")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "first_name")
private String firstName;
@Column(name = "last_name")
private String lastName;
@Column(name = "salary")
private int salary;
public Worker() {
}
public Worker(String fname, String lname, int salary) {
this.firstName = fname;
this.lastName = lname;
this.salary = salary;
}
public Long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String first_name) {
this.firstName = first_name;
}
public String getLastName() {
return lastName;
}
public void setLastName(String last_name) {
this.lastName = last_name;
}
public int getSalary() {
return salary;
}
public void setSalary(int salary) {
this.salary = salary;
}
public static Long countWorkers() {
return 2l;
}
public Integer getVersion() {
return 1;
}
public void persist() {
EntityManager em = entityManager();
try {
// em.getTransaction().begin();
em.persist(this);
// em.flush();
// em.getTransaction().commit();
} catch (Exception e) {
int i = 1;
} finally {
em.close();
}
em = entityManager();
final List<Worker> list = em.createQuery("select p from Worker p").getResultList();
System.out.println(list.size());
for (Worker current : list) {
System.out.println(current.getFirstName() + " " + current.getLastName() + " " + current.getSalary());
}
em.close();
}
public static final EntityManager entityManager() {
return EMF.get().createEntityManager();
}
}
My 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_1_0. " version="1.0">xsd
<persistence-unit name="kunde" transaction-type="RESOURCE_LOCAL">
<class>de.mash.project.server.Worker</class>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.connection.driver_class" value="org.postgresql.Driver" />
<property name="hibernate.connection.url" value="jdbc:postgresql:// localhost:5432/dev_mash" />
<property name="hibernate.connection.username" value="postgres" />
<property name="hibernate.connection.password" value="m4nu3l" />
<property name="hibernate.default_schema" value="public" />
<property name="hibernate.hbm2ddl.auto" value="create" />
<property name="hibernate.hbm2ddl.auto" value="create-drop" />
</properties>
</persistence-unit>
</persistence>
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/6Os-iI90vWwJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
No comments:
Post a Comment