You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Jérôme <th...@hotmail.com> on 2013/01/08 14:03:28 UTC

Re: JPA Enhancement with Eclipse and Ant: Class not found Exception

Hi vinbr88 and OpenJPA users ,

I know it has been a while since you post this but I have some questions !
Firstly thanks to letting us know how you solve your problem.

I'm trying to do the same as you and I got some problems and there is some
stuff that I don't understand (first time I play with ant)

            <pathelement location="build"/>
            <pathelement location="${basedir}/build/classes"/>

With this lines you specify where are your entities right ?
Why there is two pathelements ?

i'm using tomEE so all the lib like openjpa are there, do I still need to
copy the openjpa jar into the lib dir ?
In this line :

        <fileset dir="lib">
            <include name="**/*.jar"/>
        </fileset>

Or there is a way to use the one in tomEE ?

When I try to run it I got this error :

BUILD FAILED
C:\***\workspace\Dashboard2\enhance.xml:16: java.lang.NoClassDefFoundError:
org/apache/commons/lang/exception/NestableRuntimeException

On my line 16 i have this : <openjpac>

Thx in advance !




--
View this message in context: http://openjpa.208410.n2.nabble.com/JPA-Enhancement-with-Eclipse-and-Ant-Class-not-found-Exception-tp7405353p7582477.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: JPA Enhancement with Eclipse and Ant: Class not found Exception

Posted by Jérôme <th...@hotmail.com>.
Ok thx to clarify my question about the enhancement.

About your other point an id AUTO INCREMENT should be tagged as
@GeneratedValue(strategy = GenerationType.IDENTITY) in JPA.
I just insert some sample datas (so i set myself the ids to be sure what
they will be)
I don't think there is any mistakes there ?

When i copy the query that I get from JPA via the log in my database editor
it's working well. I don't get what I'm doing wrong.

Thanks for your help Kevin.



--
View this message in context: http://openjpa.208410.n2.nabble.com/JPA-Enhancement-with-Eclipse-and-Ant-Class-not-found-Exception-tp7405353p7582504.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: JPA Enhancement with Eclipse and Ant: Class not found Exception

Posted by Kevin Sutter <kw...@gmail.com>.
Hi,
At the end of the day, all enhancement processing goes through the same
class -- PCEnhancer.  So, whether you are using Ant, or a Java Agent, or
through the container-hook, all of the Entity class enhancement is being
done by this PCEnhancer class.  Granted, the processing can be affected by
the input parameters and configuration.  But, I just wanted to clarify that
the same, basic byte code enhancement processing is the same regardless of
the portal.

Losing the ids is not making sense.  I see that you didn't get any
responses to your original posting...  That's too bad.  My guess is that
this is not a common issue, so none of our users knew how to respond...

I noticed that your @Id configuration indicates that you want to use
database Identity (let the database assign the Ids).  But, your database
table doesn't seem to identify this field as being generated.  Something
along the lines as "GENERATED ALWAYS AS IDENTITY".  So, you seem to have a
mismatch between your schema definition and your entity definition.

Your example of inserts seems to indicate this as well.  Your inserts are
providing a key value (1, 2, etc).  But, if the database is generating
these values, then you shouldn't be providing key values.

When you query against the database for these entities, the id fields
should be provided.  Maybe the mismatch between your schema and entity
definitions is causing a hiccup with this processing.  Not sure.

Good luck,
Kevin

On Tue, Jan 8, 2013 at 10:07 AM, Jérôme <th...@hotmail.com> wrote:

> Ok, all right that was the case.
> Now i'm able to make it works (I guess if it says : "INFO   [main]
> openjpa.Tool - Enhancer running on type "entities.***.")
>
> I was trying to make this worked cause I have read somewhere that the
> enhancement via eclipse plugin has some troubles. It may cause the lost of
> ids.
> But even with the ant method i lost my ids,
> please see the post
>
> http://openjpa.208410.n2.nabble.com/ID-auto-increment-on-mysql-getting-null-td7581852.html
> where I explained it.
> I'm becoming crazy :)
>
> Thanks a lot for your time.
> Regards,
>
>
>
>
>
> --
> View this message in context:
> http://openjpa.208410.n2.nabble.com/JPA-Enhancement-with-Eclipse-and-Ant-Class-not-found-Exception-tp7405353p7582481.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>

Re: JPA Enhancement with Eclipse and Ant: Class not found Exception

Posted by Jérôme <th...@hotmail.com>.
Ok, all right that was the case.
Now i'm able to make it works (I guess if it says : "INFO   [main]
openjpa.Tool - Enhancer running on type "entities.***.")

I was trying to make this worked cause I have read somewhere that the
enhancement via eclipse plugin has some troubles. It may cause the lost of
ids.
But even with the ant method i lost my ids,
please see the post
http://openjpa.208410.n2.nabble.com/ID-auto-increment-on-mysql-getting-null-td7581852.html
where I explained it.
I'm becoming crazy :)

Thanks a lot for your time.
Regards,





--
View this message in context: http://openjpa.208410.n2.nabble.com/JPA-Enhancement-with-Eclipse-and-Ant-Class-not-found-Exception-tp7405353p7582481.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: JPA Enhancement with Eclipse and Ant: Class not found Exception

Posted by Kevin Sutter <kw...@gmail.com>.
Besides the OpenJPA manual [1], there is also this wiki page on OpenJPA's
enhancement processing [2].  Have you referenced these for hints?

The items you referenced below (pathelement and fileset) are just used to
create the classpath required to run the enhancement process.  You are free
to use whatever OpenJPA you have available (download, TomEE, WebSphere,
where ever the binaries can be found).

Based on the error you posted, I would guess your classpath isn't setup
correctly.

Good luck,
Kevin

[1]
http://openjpa.apache.org/builds/latest/docs/docbook/manual.html#ref_guide_pc_enhance
[2]  http://openjpa.apache.org/entity-enhancement.html

On Tue, Jan 8, 2013 at 7:03 AM, Jérôme <th...@hotmail.com> wrote:

> Hi vinbr88 and OpenJPA users ,
>
> I know it has been a while since you post this but I have some questions !
> Firstly thanks to letting us know how you solve your problem.
>
> I'm trying to do the same as you and I got some problems and there is some
> stuff that I don't understand (first time I play with ant)
>
>             <pathelement location="build"/>
>             <pathelement location="${basedir}/build/classes"/>
>
> With this lines you specify where are your entities right ?
> Why there is two pathelements ?
>
> i'm using tomEE so all the lib like openjpa are there, do I still need to
> copy the openjpa jar into the lib dir ?
> In this line :
>
>         <fileset dir="lib">
>             <include name="**/*.jar"/>
>         </fileset>
>
> Or there is a way to use the one in tomEE ?
>
> When I try to run it I got this error :
>
> BUILD FAILED
> C:\***\workspace\Dashboard2\enhance.xml:16: java.lang.NoClassDefFoundError:
> org/apache/commons/lang/exception/NestableRuntimeException
>
> On my line 16 i have this : <openjpac>
>
> Thx in advance !
>
>
>
>
> --
> View this message in context:
> http://openjpa.208410.n2.nabble.com/JPA-Enhancement-with-Eclipse-and-Ant-Class-not-found-Exception-tp7405353p7582477.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>