I have done some thinking, and I don't see any big problems ...

The basic idea is to add the following to the metamodel (and also in DSL):
- dbtable in DomainObject
- dbcolumn in Attribute
- dbcolumn in Reference

For simple unidirectional associations with multiplicity 1 it is no problem.

For bidirectional one-to-many associations it should only be possible to
define dbcolumn on the reference pointing to the one-side.

I'm not sure what to do with many-to-many associations. In some way it
should be possible to define the name of the many-to-many join table and
also the columns in that table.
One way of doing it is to use some kind of dot notation. E.g. in dsl syntax:

Entity PhysicalMedia dbtable="PHMEDIA" {
  String status length="3"
  String location
  - Set<@Media> media dbcolumn="RELMEDIA.PHMED_ID" <-> physicalMedia
}


Entity Media {
  String title !changeable
  - Set<@PhysicalMedia> physicalMedia inverse dbcolumn="RELMEDIA.MED_ID" <->
media
}


Unidirectional associations with multiplicity=many is designed as
many-to-many in the database. It is not possible to define one of the column
names, since there is only one reference. However, these might not be very
common and it might be alright to use naming convention for that.

References to BasicType requires some thought, since the column name is
built up from both the reference name and the attribute name, but that is
solvable.

/Patrik
-- 
View this message in context: 
http://www.nabble.com/-Sculptor--column-names-for-existing-database--tp15177242s17564p15205692.html
Sent from the Fornax-Platform mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Fornax-developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fornax-developer

Reply via email to