Monday, February 28, 2011

Re: GWT with JPA

I am using Eclipse and I have the javax.persistence in my class-path,
otherwise I could not compile? I use the @Entity for the shared object
used by client and server, the only possibility I found now is to
create a DAO object for the client, but then I have redundancy. I
think it is possible to do this without DAO but I am not sure how....,
otherwise I have to do it with it

many thanks for your help

On 28 Feb., 17:10, Juan Pablo Gardella <gardellajuanpa...@gmail.com>
wrote:
>  but I don't have to use maven to solve my
> @Entity annotation problem?
>
> No.
>
> How would you include the
> javax.persistence in the class-path?
>
> If you are using Eclipse see:http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.jdt.doc.u...
>
> You must add source and you can download here:http://repository.jboss.org/maven2/org/hibernate/javax/persistence/hi...
>
>  (you mean to include this in
> the .gwt.xml file?)
>
> >No.
>
> Juan
> 2011/2/28 FritzTheCat <wg27_2...@hotmail.com>
>
> > Hm, I don't use maven in my project, I saw the xml-file you posted in
> > some sample applications, but I don't have to use maven to solve my
> > @Entity annotation problem? How would you include the
> > javax.persistence in the class-path (you mean to include this in
> > the .gwt.xml file?), because at the server I already have it included,
> > otherwise I could not compile
>
> > Thanks for your help
>
> > On 28 Feb., 16:41, Juan Pablo Gardella <gardellajuanpa...@gmail.com>
> > wrote:
> > > 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"?>
> > > <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="
> >http://www.w3.org/2001/XMLSchema-instance"
> > > xsi:schemaLocation="
> >http://maven.apache.org/POM/4.0.0http://maven.apache.org/maven-v4_0_0...
> > ">
>
> > > <!-- 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>
> > > <url>http://repo2.maven.org/maven2</url>
> > > </repository>
> > > <repository>
> > > <snapshots>
> > > <enabled>false</enabled>
> > > </snapshots>
> > > <id>Public Repository Group (jboss)</id>
> > > <url>http://repository.jboss.org/nexus/content/groups/public</url>
> > > </repository>
> > > </repositories>
>
> > > </project>
>
> > > 2011/2/28 FritzTheCat <wg27_2...@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/DevGuideServe.
> > ..
> > > > 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
>
> ...
>
> Erfahren Sie mehr »

--
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