openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marco Schwarz" <marco.schw...@cioppino.net>
Subject re: JPA: adding entities to EntityManagerFactory programmatically
Date Wed, 28 May 2008 07:37:04 GMT

I work on a RCP using openJPA and Derby. It works fine.
Kann I see your RCP (and Plugin) Source?

Bye
Marco

----- Original Message -----
Da : RĂ¼diger Herrmann <rherrmann@innoopract.com>
A : users@openjpa.apache.org
Oggetto : JPA: adding entities to EntityManagerFactory
programmatically
Data : Tue, 27 May 2008 23:49:16 +0200

> Hi,
> 
> using OpenJPA in a JavaSE (Eclipse RCP) environment, I
> would like to  register JPA-annotated classes that will
> participate in the  persistence mechanism at runtime.
> 
> Background:
> Presistence-aware classes are contributed via Eclipse
> Extension  Points. All these classes have JPA annotations.
> 
> Furthermore I don't want to use class enhancement as I
> don't have  control over the VM startup parameters (like
> -javaagent) in which  the application is running in.
> Though there seems to be an effort to make class
> enhancement  optional ([1]), I couldn't find further
> information on how to  disable class enhancement.
> 
> I played around with the attached code (persist one
> instance of  class Person that has no further
> dependencies/references) but I  couldn't get it to work.
> 
> The various attempts resulted either in
>    Attempt to cast instance "...Person..." to
>    PersistenceCapable failed.  Ensure that it
>    has been enhanced.
> or
>    The type "class org.example.openjpatest.Person"
>    has not been enhanced.
> depending on wether I called
> MetaDataRepository#addMetaData() or 
> MetaDataRepository#addPersistenceAware() (no idea what the
> difference is) and wether I called mernge() before
> persist().
> 
> If desired I can send the full (Eclipse) project with all
> required  jars (HSQL, OpenJPA plus dependencies, JTA) that
> runs out-of-the-box.
> 
> 
> Thanks in advance
> RĂ¼diger
> 
> [1] https://issues.apache.org/jira/browse/OPENJPA-293
> 
> 
> 
> [Allegato : NoEnhancerExample.java]
> [Allegato : Person.java]

....

Mime
View raw message