openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rüdiger Herrmann <rherrm...@innoopract.com>
Subject Re: JPA: adding entities to EntityManagerFactory programmatically
Date Wed, 28 May 2008 22:09:24 GMT
Hi Marco,

there is not much to see yet, apart from some test cases (which, of 
course, fail).
My first goal is to 'dynamically' register entity classes at the 
EntityManagerFactory without relying on persistence.xml or the like 
and without bytecode enhancement.
The attached (non-RCP) example is all I want to see running for now.
Dealing with the class-loading issues will probably be the next step;)

Cheers,
Rüdiger



Marco Schwarz wrote:
> 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