Monday, February 28, 2011

Re: GWT with JPA

I don't do anything in my .gwt.xml for compiling my project. Are you compile with gwt-maven-plugin?

Here is my pom.xml and my .gwt-xml.

Juan

.gwt.xml:
<module rename-to='...'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User' />

<!-- Inherit the default GWT style sheet. You can change -->
<!-- the theme of your GWT application by uncommenting -->
<!-- any one of the following lines. -->
<inherits name='com.google.gwt.user.theme.standard.Standard' />
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->

<!-- Other module inherits -->
<inherits name="com.google.gwt.activity.Activity" />
<inherits name="com.google.gwt.place.Place" />
<!-- Specify the app entry point class. -->
<entry-point class='...' />

<!-- Specify the paths for translatable code -->
<source path='client' />
<source path='shared' />



</module>

pom.xml:
<?xml version="1.0" encoding="UTF-8"?>

<!-- POM file generated with GWT webAppCreator -->
<modelVersion>4.0.0</modelVersion>
<groupId></groupId>
<artifactId></artifactId>
<packaging>war</packaging>
<version></version>


<properties>
<!-- Convenience property to set the GWT version -->
<gwtVersion>2.1.1</gwtVersion>
<hibernate.version>3.6.1.Final</hibernate.version>
<!-- GWT needs at least java 1.5 -->
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>${gwtVersion}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwtVersion}</version>
<scope>provided</scope>
</dependency>
<!-- Persistencia -->
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.0-api</artifactId>
<version>1.0.0.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate.version}</version>
<exclusions>
<exclusion>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
</exclusion>
<exclusion>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
</exclusion>
<exclusion>
<groupId>asm</groupId>
<artifactId>asm</artifactId>
</exclusion>
<exclusion>
<groupId>asm</groupId>
<artifactId>asm-attrs</artifactId>
</exclusion>
<exclusion>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>${hibernate.version}</version>
<exclusions>
<exclusion>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
</exclusion>
<exclusion>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
<version>1.1</version>
</dependency>

<!-- Test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>

</dependencies>

<build>


<!-- Generate compiled stuff in the folder used for developing mode -->
<outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>

<plugins>


<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>




<!-- GWT Maven Plugin -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>2.1.0-1</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test</goal>
<goal>i18n</goal>
<!-- goal>generateAsync</goal -->
</goals>
</execution>
</executions>
<!-- Plugin configuration. There are many available options, see gwt-maven-plugin 
documentation at codehaus.org -->
<configuration>
<runTarget>embalajemadera.html</runTarget>
<hostedWebapp>${webappDirectory}</hostedWebapp>
<i18nMessagesBundle>${project.groupId}.client.Messages</i18nMessagesBundle>
<!-- Genera las interfaces Async -->
<!-- servicePattern>com/foo/client/services/*.java</servicePattern -->
</configuration>
</plugin>

<!-- Copy static web files before executing gwt:run -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>exploded</goal>
</goals>
</execution>
</executions>
<configuration>
<webappDirectory>${webappDirectory}</webappDirectory>
</configuration>
</plugin>

<!-- IDE -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.7</version>  <!-- Note 2.8 does not work with AspectJ aspect path -->
<configuration>
<downloadSources>true</downloadSources>
<downloadJavadocs>false</downloadJavadocs>
<wtpversion>2.0</wtpversion>
<additionalBuildcommands>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.google.gdt.eclipse.core.webAppProjectValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.google.gwt.eclipse.core.gwtProjectValidator</name>
<arguments>
</arguments>
</buildCommand>
</additionalBuildcommands>
<additionalProjectnatures>

<projectnature>com.google.gwt.eclipse.core.gwtNature</projectnature>
</additionalProjectnatures>
</configuration>
</plugin>


</plugins>
</build>

<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central (jboss)</id>
<name>Maven Repository Switchboard</name>
</repository>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>Public Repository Group (jboss)</id>
</repository>
</repositories>

</project>


2011/2/28 FritzTheCat <wg27_2000@hotmail.com>
Thanks Juan for your quick reply, I think I did not explain my problem
enough detailled so I try it again: My project compiles right so I
don't think it is a class-path problem in the common way: Refering to
http://code.google.com/intl/de-DE/webtoolkit/doc/latest/DevGuideServerCommunication.html#DevGuideSerializableTypes
I have to assure the following:
 # The class is annotated with a JPA javax.persistence.Entity
annotation. -> I did this in my Entity object

for example:
@Entity
public class Member implements Serializable{

       private static final long serialVersionUID = -8354006649751924339L;

       public Long id;
}

# The fully-qualified class name is listed as one of the values of the
rpc.enhancedClasses configuration property in a .gwt.xml module file
that is part of the application. -> I think this is my problem. I
don't know how to put the class into my .gwt.xml file and I cannot
find any description how to do this, I only found some comments, that
the annotation can not be read by the client gwt code (which is clear
to me), but how can I put them into the gwt.xml file?

Thanks for your help

On 28 Feb., 16:18, Juan Pablo Gardella <gardellajuanpa...@gmail.com>
wrote:
> I think you need the jpa sources in your classpath.
>
> Juan
>
> 2011/2/28 FritzTheCat <wg27_2...@hotmail.com>
>
> > Hi people,
>
> > i try to use gwt 2.2 with JPA. For this I use the @Entity annotation
> > in my shared folder and i get the error message:
> > The import javax.persistence cannot be resolved, Entity cannot be
> > resolved to a type. For me it is clear that something is missing in
> > the .gwt.xml file and I found the rpc enhanced feature but I don't
> > know how to include those classes. I used the following "<define-
> > configuration-property name="rpc.enhancedClasses" is-multi-
> > valued="true"/>" in my .gwt.xml file but I also have to define my
> > @Entity annotated classes. So how must the be defined in the .gwt.xml
> > file? Any help is appreciated,
>
> > thank you and nice greetings
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google Web Toolkit" group.
> > 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.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
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.


--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
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