openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Dick <michael.d.d...@gmail.com>
Subject Re: Files in package org.apache.openjpa.kernel.jpql.
Date Wed, 29 Apr 2009 19:53:51 GMT
Hi Ashish

I'm sorry this has been frustrating for you. Hopefully I can help I think
you're hitting a couple of problems.

1. Building the jpql package.
OpenJPA uses JavaCC to generate a JPQL parser. The source files for this
parser are in openjpa-kernel/src/main/java/org/apache/openjpa/kernel/jpql
and are .jjt files.

Eclipse on its own doesn't know how to handle these files, but there are
javacc plugins available (I have no experience with them, might not work
well with OpenJPA).  Maven has the same issue but the build automatically
downloads and uses the appropriate plugin to generate 'normal' java source
files.

What we've suggested mixes the two environments : use maven to generate
.java files, add to your eclipse classpath and you should be in good shape.

2. Running the samples.
The samples are designed to execute out of the box for people who download
apache-openjpa-x.y.z-binary.zip and extract it. Sandly they do not work out
of the box from the source archive. The ant files that run the samples would
need two different configurations because the dependent libraries are in
different places.

I haven't looked into this much but I believe all you'd have to swizzle the
classpath in build.xml, and specify database connection properties. It's
probably not trivial, but it is doable if you have experience with ant (and
openjpa).

It sounds like you have eclipse configured correctly and you're trying to
validate that OpenJPA works. If that's the case I propose using the unit
tests in openjpa-persistence-jdbc, instead of the samples. If you have jUnit
on your classpath (chances are you do, or else they wouldn't compile) then
you can right click on a TestCase -> run as -> jUnit test.

The chances are that the testcase will fail becuase you haven't specified
the connection information. To do that edit the run configuration and add
the following jvm arguments :
-Dopenjpa.ConnectionURL=jdbc:derby:target/database/jpa-test-database;create=true

-Dopenjpa.ConnectionDriverName=org.apache.derby.jdbc.EmbeddedDriver

This tells openjpa to use the Embedded version of Derby (a new db will be
created in target/database/jpa-test-database). Derby doesn't require
authentication and you should be in business. Some tests may require you to
enhance the entities, but lets not get ahead of ourselves (I've written
enough as it is).

Hope this helps, and feel free to keep asking questions.

-mike

On Tue, Apr 28, 2009 at 10:36 PM, ashishpaliwal <ashishpaliwal.bit@gmail.com
> wrote:

>
> Hi,
>
> Thanks people but some how I am still not able to run examples. I took
> fresh code and build id succesfully using maven. After this I included
> project in eclipse. What was happening was when I tried to run
> hellojpa example eclipse was deleting the target folder and creating
> again(probably building the code) but it was not creating the complete
> files under classes\org\apache\openjpa\kernel\jpql package that were
> created by mavne like TreeConstant. So I build it again using maven,
> saved the classes folder on Desktop and added path to this
> Desktop/classes in my classpath. After this all the errors were
> removed after refreshing but on running it wasn't able to create the
> factory in very first line of hellojpa example.
> I am really not able to follow firstly why eclipse is not generating
> the complete classs and secondly why I am not getting factory created.
> I din't do any changes in persistance.xml or build.xml files. It will
> be of great help if someone can throw some light on my problem.
>
> thanks
>
> On Tue, Apr 28, 2009 at 8:53 PM, Kevin Sutter (via Nabble)
> <ml-user+17993-75047603@n2.nabble.com<ml-user%2B17993-75047603@n2.nabble.com>>
> wrote:
> > Hi Ashish,
> > These "extra" files are generated as part of our JJTree processing.  It
> > sounds like you successfully built the OpenJPA project using maven, so
> > that's good.  Within Eclipse, you need to tell Eclipse about these other
> > generated files to complete your build.  If you look under
> > ../target/generated-sources/, you'll find these missing files.  You'll
> need
> > to add this directory to your build configuration within Eclipse.
> >
> > Kevin
> >
> > On Tue, Apr 28, 2009 at 10:01 AM, ashish paliwal <
> > ashishpaliwal.bit@...> wrote:
> >
> >> Hi,
> >>
> >> I downloaded the latest code using -- svn co
> >> http://svn.apache.org/repos/asf/openjpa/trunk mydir and then build it
> >> successfully using maven. After importing all the source into eclipse
> >> I was encountering few errors in package
> >> /org/apache/openjpa/kernel/jpql. For instance in class
> >> JPQLExpressionBuilder it couldn't find JPQLTreeConstants, and there
> >> were many others. I then downloaded the nightly build
> >> apache-openjpa-2.0.0-SNAPSHOT-binary.zip and in this in
> >> openjpa-2.0.0-SNAPSHOT.jar file inside the package
> >> org.apache.openjpa.kernel.jpql there were more files(e.g
> >> JPQLTreeConstants.class) than what I had after downloading code using
> >> svn.
> >> Now I am not able to understand where are these files in my code that
> >> I have taken from svn. Am I looking in some wrong package or do I need
> >> to include some jar in my build path in eclipse? It will be of great
> >> help to me if someone can throw some light on this.
> >>
> >> Thanks and regards
> >>
> >> Ashish Paliwal
> >> Mobile : 9305128367
> >> IIT Kanpur
> >> India
> >>
> >
> >
> > ________________________________
> > View message @
> >
> http://n2.nabble.com/Files-in-package-org.apache.openjpa.kernel.jpql.-tp2734002p2734132.html
> > To start a new topic under OpenJPA Users, email
> > ml-node+208411-1807955471@n2.nabble.com<ml-node%2B208411-1807955471@n2.nabble.com>
> > To unsubscribe from OpenJPA Users, click here.
> >
>
>
>
> --
> Ashish Paliwal
> Mobile : 9305128367
> IIT Kanpur
> India
>
> --
> View this message in context:
> http://n2.nabble.com/Files-in-package-org.apache.openjpa.kernel.jpql.-tp2734002p2738437.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message