Hi Andrea,

> question:There is a way to map a primary key over multiple
> tables in a db?

I'm not quite sure, what you mean:

- having the same primary key _column_ name/type in different
  tables? This is definitely allowed in SQL.

- using the same primary key _class_ in different beans?
  This is allowed, see EJB spec 1.1 section 8.5 and illustratet
  by the fact, that i.e. java.lang.Integer is a valid primary
  key class.

- having one bean stored 'horizontally' splittet over several
  tables, which share the primary key (i.e. so, that heavily used
  fields/columns are stored in a fast DB and others in a slower
  (remote) one)? I don't think, you can do this currently with
  JBoss CMP (using JAWS), but I may be wrong (we use BMP here).
  Others may correct this statement. With BMP you can do this
  split easily, and in ejbLoad either join the data together
  to fetch them in just one JDBC call, or only load the important
  fields from the fast DB lazily loading the rest from the slow
  DB in the apropriate business methods.

- having one bean stored in different tables 'vertically' i.e.
  depending on some type field (so as to store old data into
  a DB on a cheap slow server with high data capacity and actual
  data into a DB on an expensive fast server with limited data
  capacity)? Again I believe, this is currently impossible with
  JAWS CMP. And again, you may easily do that with BMP, if you
  have your tables in one DB you might use the SQL UNION syntax
  to access all tables with only one SQL statement in ejbLoad,
  or query all tables until you've found your row back (if you
  can't decide from the primary key, where to search for the data).

If I misunderstood you completely, please clarify.

regards

Georg
 ___   ___
| + | |__    Georg Rehfeld      Woltmanstr. 12     20097 Hamburg
|_|_\ |___   [EMAIL PROTECTED]           +49 (40) 23 53 27 10



_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to