1 10 11 package com.triactive.jdo.store; 12 13 import com.triactive.jdo.model.FieldMetaData; 14 import com.triactive.jdo.model.CollectionMetaData; 15 import javax.jdo.JDOUserException; 16 17 18 public class SetTable extends FieldTable 19 { 20 private ColumnMapping ownerMapping; 21 private ColumnMapping elementMapping; 22 23 24 protected SetTable(TableMetadata tmd, FieldMetaData fmd, StoreManager storeMgr) 25 { 26 super(tmd, fmd, storeMgr); 27 } 28 29 30 public void initialize() 31 { 32 assertIsUninitialized(); 33 34 CollectionMetaData colmd = fmd.getCollectionMetaData(); 35 if (colmd == null) 36 throw new JDOUserException("No collection metadata found in " + fmd); 37 38 Class elementType = colmd.getElementType(); 39 40 SQLIdentifier ownerColumnName = getBaseColumnNameForType(ownerType); 41 SQLIdentifier elementColumnName = getBaseColumnNameForType(elementType); 42 43 Column ownerColumn = newColumn(ownerType, ownerColumnName, Role.OWNER).setPrimaryKeyPart(); 44 Column elementColumn = newColumn(elementType, elementColumnName, Role.ELEMENT).setPrimaryKeyPart(); 45 46 elementColumn.setOptions(colmd.getElementColumnOptions()); 47 48 ownerMapping = dba.getMapping(ownerColumn); 49 elementMapping = dba.getMapping(elementColumn); 50 51 state = TABLE_STATE_INITIALIZED; 52 } 53 54 55 public ColumnMapping getOwnerMapping() 56 { 57 assertIsInitialized(); 58 59 return ownerMapping; 60 } 61 62 63 public ColumnMapping getElementMapping() 64 { 65 assertIsInitialized(); 66 67 return elementMapping; 68 } 69 } 70 | Popular Tags |