This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 73183 - API needed for retrieving container managed persistence provider
Summary: API needed for retrieving container managed persistence provider
Status: RESOLVED FIXED
Alias: None
Product: serverplugins
Classification: Unclassified
Component: Infrastructure (show other bugs)
Version: 5.x
Hardware: All All
: P3 blocker (vote)
Assignee: Petr Hejl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-03-02 15:26 UTC by Erno Mononen
Modified: 2011-10-17 09:36 UTC (History)
2 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Erno Mononen 2006-03-02 15:26:07 UTC
It would be nice to have an API for getting target platform's default 
persistence provider (i.e. container managed provider), something like 
J2eePlatform#getPersistenceProvider(). Method could return defined constants 
instead of Provider to avoid dependencies. Currently one has to retrieve server 
id (and know which id each server has since there's no API) and then resolve 
provider manually.
Comment 1 Erno Mononen 2006-03-10 12:33:59 UTC
Currently supported providers are: 
Hibernate (JBoss)
Toplink (Glassfish)
Kodo (BEA)

Respective constants (as in ProviderUtil):
HIBERNATE_PROVIDER
TOPLINK_PROVIDER
KODO_PROVIDER
Comment 2 Pavel Buzek 2006-03-13 14:39:56 UTC
Erno, it is not clear what you want to achive with this API - how would it be
used? I assume there is code that know what provider class to use for every
persistence provider, what vendor specific properties to use, etc. Ideally this
all would be part of this API and provided by the server plugin. If it is not
(and it is hardwired in j2ee/persistence?) then you could as well hardwire
everything. This seems like a half of the solution. Or maybe I missunderstood.
Comment 3 Erno Mononen 2006-03-13 15:23:17 UTC
I agree that it is not a complete solution. The specific case that I had was 
that there was (is) no API for retrieving the actual server, so you have to 
write things like: 
if ("J2EE".equals(j2eeModuleProvider.getServerID)) // return toplink 
else if ("JBoss".equals(j2eeModuleProvider.getServerID)) / return hibernate 
... 
And you have to know those strings ("J2EE", "JBoss") by heart since there is no 
API for them, which in my opinion is rather ugly. So my initial need was just to 
have an API to retrieve the actual server, API for getting providers followed 
that. Ideal case (from my point of view) would be to have server plugins to 
return actual providers, since I think that it would be quite logical for server 
to know its provider(s). I understand that this is probably not doable because 
of the dependencies it would create, so returning constants seems like the 
second best option. This way adding new server plugins wouldn't require changes 
in j2ee/persistence (assuming that appropriate Provider is already implemented).


Comment 4 Petr Jiricka 2006-04-05 10:23:43 UTC
Is this still needed? If so, what's the next step?
Comment 5 Petr Jiricka 2006-04-05 10:23:55 UTC
Is this still needed? If so, what's the next step?
Comment 6 Sherold Dev 2006-05-30 16:28:56 UTC
this is not going to be fixed in 5.5. TM -> Dev
Comment 7 Petr Hejl 2011-10-17 09:36:59 UTC
Already resolved by javaee.specs.support.