01: /**********************************************************************
02: Copyright (c) 2005 Andy Jefferson and others. All rights reserved.
03: Licensed under the Apache License, Version 2.0 (the "License");
04: you may not use this file except in compliance with the License.
05: You may obtain a copy of the License at
06:
07: http://www.apache.org/licenses/LICENSE-2.0
08:
09: Unless required by applicable law or agreed to in writing, software
10: distributed under the License is distributed on an "AS IS" BASIS,
11: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12: See the License for the specific language governing permissions and
13: limitations under the License.
14:
15:
16: Contributors:
17: ...
18: **********************************************************************/package org.jpox.store.mapping;
19:
20: import org.jpox.metadata.ColumnMetaData;
21: import org.jpox.store.DatastoreField;
22:
23: /**
24: * Mapping for a serialised PersistenceCapable object being the value of a Map.
25: *
26: * @version $Revision: 1.6 $
27: */
28: public class SerialisedValuePCMapping extends SerialisedPCMapping {
29: /**
30: * Method to prepare a field mapping for use in the datastore.
31: * This creates the column in the table.
32: */
33: protected void prepareDatastoreMapping() {
34: MappingManager mmgr = datastoreContainer.getStoreManager()
35: .getMappingManager();
36: ColumnMetaData colmd = null;
37: if (fmd.getValueMetaData() != null
38: && fmd.getValueMetaData().getColumnMetaData() != null
39: && fmd.getValueMetaData().getColumnMetaData().length > 0) {
40: colmd = fmd.getValueMetaData().getColumnMetaData()[0];
41: }
42: DatastoreField col = mmgr.createDatastoreField(this , getType(),
43: colmd);
44: mmgr.createDatastoreMapping(this , fmd, 0, datastoreContainer
45: .getStoreManager(), col);
46: }
47: }
|