newbie q #1: CMR across schemas?

Michael Harm <[email protected]>
Newsgroups gmane.comp.java.ejb.middlegen.user
Message-ID <[email protected]>
Hi.

Sorry if this is a silly one.. I'm new to this.

We have a set of tables that are sort of a shared resource to be used 
across multiple projects.  It's in a schema called "vocabulary" (on 
oracle 9i).

There are other projects that use these tables, with foreign key 
relationships into them. Those projects each are in their own schema.

I'd like to be able to deploy these projects separately into jboss 
(3.2.1), each in their own WAR file, but preserving the CMR 
relationships to "vocabulary".

But middlegen operates at the granularity of a single schema, as near 
as I can tell.  So the CMR relationships don't happen.  I can run 
middlegen twice for a given project, once on, say, "clinical_trials", 
and again on "vocabulary", but it doesn't kick out the right cmr stuff. 
  ejbdoclet lets me add additional entity descriptors to the 
ejb-jar.xml, but doesn't seem to have a hook for additional 
<ejb-relation> thingies.  And maybe it's a bad idea to have an entitity 
(say, a bean from the "vocabulary" schema) existing in multiple WAR 
files anyway.

I've tried using oracle's synonyms, creating a synonym of 
vocabulary.concept as 'concept' visible in schema 'clinical_trials' 
with the fk relationship on that, but middlegen still doesn't see the 
'concept' guy, even if its explicitly named in the <table> directives.  
I've also tried leaving off the 'schema' attribute to the middlegen 
task and coding the schema prefix in the <table> directives, but it 
doesn't see the tables with a schema prefix.

What's the best practice for having a bean that is used across multiple 
projects?  Keep everything in the same schema, and each project picks 
the stuff it needs using the middlegen <table> directive rather than 
scooping in everything?  Is there a danger in having beans referencing 
a given table deployed to multiple WAR files?  Or is jboss smart enough 
to figure this out?

I'll get more concrete:  in schema vocabulary, there's a table called 
CONCEPT with pk concept_id.  In schema clinical_trials there's a table 
TRIAL, with a field trial_type_id.  It's got a foreign key relationship 
to vocabulary.concept(concept_id).  When I do a project relating to 
clinical_trials, I'd like to end up with cmr relationships, and be able 
to get to the concept bean.  And there's another project in schema 
clinical_repository that has other tables with fk relationships into 
vocabulary.concept(concept_id), and I'd like those to be able to 
reference a concept bean as well.

Any tips on the right way to architect this?

(in this case, the stuff in the 'vocabulary' schema is all read-only.  
That may help with this particular case, and any info that would be 
great, but I'd also like to know about the more general case where the 
shared schema isn't readonly).

Thanks!

Michael Harm
Stanford University School of Medicine



-------------------------------------------------------
This SF.net email sponsored by: Enterprise Linux Forum Conference & Expo
The Event For Linux Datacenter Solutions & Strategies in The Enterprise 
Linux in the Boardroom; in the Front Office; & in the Server Room 
http://www.enterpriselinuxforum.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.