openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hugh (JIRA)" <>
Subject [jira] Commented: (OPENJPA-1860) How do I get OpenJPA to use my custom classloader to load Entity classes?
Date Thu, 04 Nov 2010 00:47:41 GMT


Hugh commented on OPENJPA-1860:

I have a template which I keep in META-INF/orm.xml
This is inside a jar file so I can't modify it directly. I have to intercept the getResource
request in my custom classloader and write my custom xml.orm based on information (the table
name) that's only available at runtime. I then return this resource URL.
Business may add new tables at any time and deploy a new instance of the application to service
that new table so I have no idea about table names at compile time.

I'm using OpenJPA 2.0.1 and I'll get you the rest of the information shortly.
I'll do a test to see if orm.xml is ignored without any modifications from me for NamedQueries
as well if I have time.

> How do I get OpenJPA to use my custom classloader to load Entity classes?
> -------------------------------------------------------------------------
>                 Key: OPENJPA-1860
>                 URL:
>             Project: OpenJPA
>          Issue Type: Question
>          Components: jpa
>    Affects Versions: 2.0.1
>         Environment: OpenJPA 2.0.1 Java 1.6-22
>            Reporter: Hugh
> I have written a custom classloader and I can't work out how to get OpenJPA to use it
to load my entity classes.
> I've followed instructions I found to set Thread.currentThread().setContextClassLoader()
at startup before loading any EntityManager and it seems to load the OpenJPA classes and a
lot of others, but not the class I'm interested in.
> Is this the right approach?
> If so, where have I gone wrong? (
> If not, how should this be done?
> Is there some sort of guide to accomplishing this that someone could point me to?
> Thanks.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message