Re: How to use Request Factory with JPA Hibernate and PostgreSQL ?

2012-09-28 Thread Manuel
Hey,

here an update on my topic.

I could solve the problem.


I created a new Project without App Engine. Now the persistence.xml gets 
used like expected.
App Engine caused, that datanucleus instead of hibernate were used.

Regards

-- 
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/-/Bi-7F3cgwOYJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: How to use Request Factory with JPA Hibernate and PostgreSQL ?

2012-09-26 Thread Manuel
Hey,

I use the following persistence.xml now. I dont get a exception anymore but 
I still dont get any records saved into my database either.

I also should see some SQL statements in my console if he would commit any 
SQL, right? I dont see any SQL :(

If I change databasename or password to any wrong value, I dont get any 
error/exception. Everything still "works".


Has anyone an idea? Any help is much appreciated.
Regards

Heres the persistence.xml:


de.mash.project.server.Worker
















-- 
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/-/KpZyLqsz1wIJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: How to use Request Factory with JPA Hibernate and PostgreSQL ?

2012-09-26 Thread Manuel
Btw, do I have to disable App Engine ?   Actually My 
Project-Propertys->Google->App Engine-> Use Google App Engine is set.
Do I have to configurate jdoconfig.xml?

When i use the following persistence.xml I dont get the exception anymore, 
buts its still not working :(

Thats the output:
Sep 26, 2012 7:13:11 PM org.hibernate.engine.jdbc.internal.JdbcServicesImpl 
configure
WARN: HHH000342: Could not obtain connection to query metadata : Der 
Verbindungsversuch schlug fehl.

Any ideas? :/
Adding i.e.  10 
I get the ecxeption again.

I had already tested the connection data with a jdbc connect, so they 
should be right.



Thats the xml:


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"; 
version="1.0">


org.hibernate.ejb.HibernatePersistence


  
  
  
  
  
 







Am Mittwoch, 26. September 2012 04:36:05 UTC+2 schrieb Manuel:
>
> Hi everyone,
>
> I want to use a postgres db with the RF JPA.
> I dont know if I´m on the right way, but I thought i just have to edit the 
> persistence.xml?
>
>
> Thats what my persistence.xml look like:
>
> 
> 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"; 
> version="1.0">
>
>  transaction-type="RESOURCE_LOCAL">
> 
> org.eclipse.persistence.jpa.PersistenceProvider
> 
> 
> 
>  value="jdbc:postgresql://localhost:5432/dev_mash" />
> 
> 
> true
>  name="dialect">org.hibernate.dialect.PostgreSQLDialect
> 
>  />
> 
> 
> 
> 
>
>
> I just started to work on that, so any help is much appreciated.
> If you need any further information, please let me know.
>
> Thanks in advanced.
>
> Regards
>

-- 
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/-/L3wlMETqQlgJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: How to use Request Factory with JPA Hibernate and PostgreSQL ?

2012-09-26 Thread Manuel
Some more Info:
Thats the Worker.java class:

package de.mash.project.server;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Persistence;
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();
EntityManagerFactory emf = 
Persistence.createEntityManagerFactory("transactions-optional");
EntityManager em = emf.createEntityManager();
try {
em.persist(this);
} catch (Exception e) {
int i = 1;
} finally {
em.close();
}
}

public static final EntityManager entityManager() {
return EMF.get().createEntityManager();
}

}

-- 
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/-/8u2bMxOgz3QJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: How to use Request Factory with JPA Hibernate and PostgreSQL ?

2012-09-26 Thread Manuel
Hmm ok.. so whats the provider?
Found this org.hibernate.ejb.HibernatePersistence one.

I updated the provider and put my class (Worker.java) in the 
persistence.xml but Iam still get an exception:
When i create the EntityManagerFactory, 
ReflectiveServiceLayer.invoke(Method domainMethod, Object... args) throws 
an exception (InvocationTargetException).

So far, i couldnt find any tutorial to get this working.
So any help is much appreciated.

Regards


Thats my current persistence.xml:


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"; 
version="1.0">


org.hibernate.ejb.HibernatePersistence
de.mash.server.Worker






true
org.hibernate.dialect.PostgreSQLDialect







Heres what i get from the console:

com.google.web.bindery.event.shared.UmbrellaException: One or more 
exceptions caught, see full set in UmbrellaException#getCauses
at 
com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext$StandardPayloadDialect.processPayload(AbstractRequestContext.java:387)
at 
com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext$5.onTransportSuccess(AbstractRequestContext.java:1108)
at 
com.google.web.bindery.requestfactory.gwt.client.DefaultRequestTransport$1.onResponseReceived(DefaultRequestTransport.java:136)
at 
com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:287)
at 
com.google.gwt.http.client.RequestBuilder$1.onReadyStateChange(RequestBuilder.java:395)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at 
com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at 
com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
at 
com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:337)
at 
com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:218)
at 
com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
at 
com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
at 
com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
at 
com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:213)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at 
com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at 
com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
at 
com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:292)
at 
com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:546)
at 
com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.RuntimeException: Server Error: Explicit persistence 
provider error(s) occurred for "transactions-optional" after trying the 
following discovered implementations: 
org.datanucleus.api.jpa.PersistenceProviderImpl, 
org.hibernate.ejb.HibernatePersistence from provider: 
org.hibernate.ejb.HibernatePersistence
at 
com.google.web.bindery.requestfactory.shared.Receiver.onFailure(Receiver.java:44)
at 
com.google.web.bindery.requestfactory.shared.impl.AbstractRequest.onFail(AbstractRequest.java:118)
at 
com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext$StandardPayloadDialect.processPayload(AbstractRequestContext.java:359)
at 
com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext$5.onTransportSuccess(AbstractRequestContext.java:1108)
at 
com.google.web.bindery.requestfactory.gwt.client.DefaultRequestTransport$1.onResponseReceived(DefaultRequestTransport.java:136)
at 
com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:287)
at 
com.google.gwt.http.client.RequestBuilder$1.onReadyStateChange(RequestBuilder.java:395)
at sun.reflect.NativeMethodAccessorImpl.in

Re: How to use Request Factory with JPA Hibernate and PostgreSQL ?

2012-09-26 Thread Jens
If you want to use Hibernate I guess the persistence provider is wrong. 
Looks like its the one of EclipseLink.

-- J.

-- 
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/-/TpOZmrWlVeAJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.