Well, I'm not sure. We really need some injection, and I'd need to be sure it's a feature and we don't get it by accident. So, I look at the sources. I'm not quite sure, but I found this in EntityManagerSetupImpl.java:
line 712:
session = new ServerSession(new Project(new DatabaseLogin()));
(comment before try-block: // state is INITIAL, PREDEPLOY_FAILED or UNDEPLOYED )
I checked all non-null assignments of the session field, and it seems it's the only one we should be concerned with, the other one being in an "if (isSessionLoadedFromSessionsXML)"-block. Or could sessions.xml help?
Any more information?
Anyway, I'll keep you informed of the progress I'll make; I'll rewrite some classes if needed, I know it's a bad idea, but we need that feature. Should someone know some better way, please let me know ;-)
James Sutherland wrote:
This should work fine if you put the persistence unit of the server's applib (server's shared classpath) and access it as application managed (i.e. Persistence.class). I don't think there is any way to access it as container managed, (i.e. injection), (although you could try, it might work).
Weaving will most likely not occur, so you could statically weave your jar.