You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by abug <ag...@tzi.de> on 2010/03/23 23:50:51 UTC

Use external classes as entities

Hello,

I'm in the following situation: I have a a model with 3 entities and 2 of
them are inside a framework (iCal4j). Currently I try to store both external
classes as properties inside one of my classes (they are Serializable). This
is a little bit ugly and I would like to split things up in three entities
like this:

       ForeignClass1
         /
MyClass
         \
       ForeignClass2

Is there a possibility to tell OpenJPA to use ForeignClass1 and
ForeignClass2 as separate entities that have relations with MyClass? My
first thought was to edit the persistence.xml, but I didn't find any
relevant documentation how to describe this situation. My second thought was
to subclass ForeignClass1 and ForeignClass2, but I would like to avoid this
(I don't really have a need for subclassing). Any ideas?

Cheers,
Aga
-- 
View this message in context: http://n2.nabble.com/Use-external-classes-as-entities-tp4787743p4787743.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: Use external classes as entities

Posted by Jeremy Bauer <te...@gmail.com>.
This may/may not work depending on your environment and the class
definitions, but you could try defining the mappings and metadata for
ForeignClass1 and ForeignClass2 in an orm.xml file.

Another issue will be getting these classes enhanced and verifying they
still behave properly after enhancement  (ie. the business logic, if any,
still works properly).  If you are in a JSE environment, you could try using
the agent enhancer.  It will enhance the classes as they are loaded (no need
to modify the jar).  You'll likely need to specify the iCal4j jar in a
<jar-file> element and define the foreign classes in <class> elements within
your persistence.xml.

-Jeremy

On Wed, Mar 24, 2010 at 2:25 PM, Pinaki Poddar <pp...@apache.org> wrote:

>
> > Any ideas?
>
> Please see [1]
>
> [1] http://openjpa.apache.org/builds/latest/docs/manual/manual.html#type
>
> -----
> Pinaki
> --
> View this message in context:
> http://n2.nabble.com/Use-external-classes-as-entities-tp4787743p4793276.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>

Re: Use external classes as entities

Posted by Pinaki Poddar <pp...@apache.org>.
> Any ideas? 

Please see [1]

[1] http://openjpa.apache.org/builds/latest/docs/manual/manual.html#type

-----
Pinaki 
-- 
View this message in context: http://n2.nabble.com/Use-external-classes-as-entities-tp4787743p4793276.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.