SCJP, SCJD, SCWCD 1.3, SCWCD 1.4, SCBCD
I would have think of some standard way to get metadata information on an entity bean, some getMetaData() home method for instance. I guess that such an extension may exist but is vendor-specific ?
The problem is that I have no real-world J2EE experience, in such a way that anything which is not covered by the specs are for me unknown, or at best just guesses.
suppose that it would be possible for the bean provider to write such a getMetaData() home method by himself, with the help of the JDBC java.sql.DatabaseMetaData interface, and ideally in a superclass of his CMP entity beans to make that code reusable for all of them.
SCJP, SCJD, SCWCD 1.3, SCWCD 1.4, SCBCD
I've read your discussions on many threads and have great respect for your views. Though you might not have hands-on J2EE experience as yet, it's just a matter of time before you start rolling on this one too.
![]()
Phil:
suppose that it would be possible for the bean provider to write such a getMetaData() home method by himself, with the help of the JDBC java.sql.DatabaseMetaData interface, and ideally in a superclass of his CMP entity beans to make that code reusable for all of them.
Sathya:
Yes, without overruling the specification, the method could be in a superclass of the CMP bean, but as stated previously no, not in the home interface.
Unfortunately, for SCBCD and SCWCD the answer to most such "Why ?" questions doesn't help much : "Because that's written in the specs.".
Why not through the home interface ? It would not be a method linked to a particular bean instance, right ? I thought of some ejbHomeGetMetaData() method, with its result possibly cached in some metaData private class variable. Did I miss something ?
SCJP, SCJD, SCWCD 1.3, SCWCD 1.4, SCBCD
Example: Here are our classes -
1. test.MyBean implements EntityBean
2. Remote interface: test.MyRemoteIntf implements EjbObject
3. Home interface: test.MyEjbHome implements EJBHome
We can specify the custom method ejbHomeGetMetaData() in MyEjbHome.
But it is the container that will provide the implementation of the home interface. And the container cannot provide the implementations of methods beyond those dictated by the spec (create, remove etc...). This means that the developer will have to provide a custom implementation of the home interface...something like test.MyEjbHomeImpl implements MyEjbHome and instruct the container to use this home interface implementation.
Now this'll be a container specific provision and if MyBean relies on this implementaion, it is not portable to a generic EJB server.
In test.MyEjbHome you'll have a public MyMetaData getMetaData() home business method implemented in test.MyBean in a public MyMetaData ejbHomeGetMetaData() method.
SCJP, SCJD, SCWCD 1.3, SCWCD 1.4, SCBCD