All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.eclipse.persistence.descriptors.RelationalDescriptor Maven / Gradle / Ivy

/*******************************************************************************
 * Copyright (c) 1998, 2012 Oracle and/or its affiliates. All rights reserved.
 * This program and the accompanying materials are made available under the 
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 
 * which accompanies this distribution. 
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
 * and the Eclipse Distribution License is available at 
 * http://www.eclipse.org/org/documents/edl-v10.php.
 *
 * Contributors:
 *     Oracle - initial API and implementation from Oracle TopLink
 *     
 ******************************************************************************/  
package org.eclipse.persistence.descriptors;

import java.util.*;

import org.eclipse.persistence.exceptions.*;
import org.eclipse.persistence.internal.descriptors.VirtualAttributeMethodInfo;

/**
 * 

Purpose: EclipseLink has been designed to take advantage of the similarities between * relational databases and objects while accommodating for their differences, providing an object * oriented wrapper for relational databases. This is accomplished through the use of Descriptors. * A descriptor is a pure specification class with all its behavior deputized to DescriptorEventManager, * DescriptorQueryManager and ObjectBuilder. Look at the following variables for the list * of specification on the descriptor. *

* A Descriptor is a set of mappings that describe how an objects's data is to be represented in a * relational database. It contains mappings from the class instance variables to the table's fields, * as well as the transformation routines necessary for storing and retrieving attributes. As such * the descriptor acts as the link between the Java object and its database representation. *

* Every descriptor is initialized with the following information: *

    *
  • The Java class its describes, and the corresponding table(s) for storing instances of the class. *
  • The primary key of the table. *
  • A list of query keys for field names. *
  • A description of the objects's attributes and relationships. This information is stored in mappings. *
  • A set of user selectable properties for tailoring the behavior of the descriptor. *
* *

This descriptor subclass should be used for object-relational mapping, * and allows for other datatype mappings to be done in the XML, EIS and OR sibling classes. * * @see DescriptorEventManager * @see DescriptorQueryManager * @see InheritancePolicy * @see InterfacePolicy */ public class RelationalDescriptor extends ClassDescriptor { /** This flag stores whether this descriptor is using Property access based on JPA semantics. It is used to modify * the behavior of our weaving functionality as it pertains to adding annotations to fields */ protected boolean weavingUsesPropertyAccess = false; /** A list of methods that are used by virtual mappings. This list is used to control weaving of methods * used for virtual access*/ protected List virtualAttributeMethods = null; /** * PUBLIC: * Return a new descriptor. */ public RelationalDescriptor() { super(); this.virtualAttributeMethods = new ArrayList(); } /** * PUBLIC: * Specify the table name for the class of objects the receiver describes. * If the table has a qualifier it should be specified using the dot notation, * (i.e. "userid.employee"). This method is used if there is more than one table. */ public void addTableName(String tableName) { super.addTableName(tableName); } /** * PUBLIC: * Return the name of the descriptor's first table. * This method must only be called on single table descriptors. */ public String getTableName() { return super.getTableName(); } /** * PUBLIC: * Return the table names. */ public Vector getTableNames() { return super.getTableNames(); } /** * INTERNAL: * Return the list of virtual methods sets for this Entity. * This list is used to control which methods are weaved **/ public List getVirtualAttributeMethods() { return virtualAttributeMethods; } /** * PUBLIC: * The descriptors default table can be configured if the first table is not desired. */ public void setDefaultTableName(String defaultTableName) { super.setDefaultTableName(defaultTableName); } /** * PUBLIC: * Specify the table name for the class of objects the receiver describes. * If the table has a qualifier it should be specified using the dot notation, * (i.e. "userid.employee"). This method is used for single table. */ public void setTableName(String tableName) throws DescriptorException { super.setTableName(tableName); } /** * PUBLIC: * Specify the all table names for the class of objects the receiver describes. * If the table has a qualifier it should be specified using the dot notation, * (i.e. "userid.employee"). This method is used for multiple tables */ public void setTableNames(Vector tableNames) { super.setTableNames(tableNames); } /** * PUBLIC: Set the table Qualifier for this descriptor. This table creator will be used for * all tables in this descriptor */ public void setTableQualifier(String tableQualifier) { super.setTableQualifier(tableQualifier); } /** * INTERNAL: * Set the list of methods used my mappings with virtual access * this list is used to determine which methods to weave */ public void setVirtualAttributeMethods(List virtualAttributeMethods) { this.virtualAttributeMethods = virtualAttributeMethods; } /** * INTERNAL: * Return whether this descriptor uses property access. This information is used to * modify the behavior of some of our weaving features */ public boolean usesPropertyAccessForWeaving(){ return weavingUsesPropertyAccess; } /** * INTERNAL: * Record that this descriptor uses property access. This information is used to * modify the behavior of some of our weaving features */ public void usePropertyAccessForWeaving(){ weavingUsesPropertyAccess = true; } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy