Search in sources :

Example 31 with AbstractSession

use of org.eclipse.persistence.internal.sessions.AbstractSession in project eclipselink by eclipse-ee4j.

the class JGroupsConfigurationTest method test.

@Override
protected void test() throws Throwable {
    AbstractSession session = getAbstractSession();
    RemoteCommandManager rcm = new RemoteCommandManager(session);
    TransportManager transport = (TransportManager) Class.forName("org.eclipse.persistence.sessions.coordination.jgroups.JGroupsTransportManager").getConstructor().newInstance();
    rcm.setTransportManager(transport);
    transport.createLocalConnection();
    RemoteConnection connection = transport.getConnectionToLocalHost();
    try {
        int multicastPort = getMulticastPort(connection);
        Assert.assertEquals("Default multicast port different than expected", 45588, multicastPort);
    } catch (Exception x) {
        Assert.fail("Failed to retrieve multicast port: " + x.getMessage());
    } finally {
        connection.close();
    }
    rcm = new RemoteCommandManager(session);
    transport = (TransportManager) Class.forName("org.eclipse.persistence.sessions.coordination.jgroups.JGroupsTransportManager").getConstructor().newInstance();
    transport.setConfig("org/eclipse/persistence/testing/config/distributedservers/rcm/jgroups/jgroups-udp-config.xml");
    rcm.setTransportManager(transport);
    transport.createLocalConnection();
    connection = transport.getConnectionToLocalHost();
    try {
        int multicastPort = getMulticastPort(connection);
        Assert.assertEquals("Configured multicast port different than expected", 45678, multicastPort);
    } catch (Exception x) {
        Assert.fail("Failed to retrieve multicast port: " + x.getMessage());
    } finally {
        connection.close();
    }
}
Also used : RemoteCommandManager(org.eclipse.persistence.sessions.coordination.RemoteCommandManager) TransportManager(org.eclipse.persistence.sessions.coordination.TransportManager) RemoteConnection(org.eclipse.persistence.internal.sessions.coordination.RemoteConnection) AbstractSession(org.eclipse.persistence.internal.sessions.AbstractSession)

Example 32 with AbstractSession

use of org.eclipse.persistence.internal.sessions.AbstractSession in project eclipselink by eclipse-ee4j.

the class TargetInvocationWhileInstantiatingMethodBasedProxyTest method setup.

@Override
protected void setup() throws NoSuchMethodException {
    descriptor = new RelationalDescriptor();
    descriptor.setJavaClass(TargetInvocationWhileInstantiatingMethodBasedProxyTest.class);
    descriptor.addTableName("Dummy_Table");
    row = new DatabaseRecord();
    Class<?>[] parmClasses = { DatabaseRecord.class };
    theMethod = TargetInvocationWhileInstantiatingMethodBasedProxyTest.class.getDeclaredMethod("invalidMethod", parmClasses);
    theTransformer = new MethodBasedAttributeTransformer();
    theTransformer.setAttributeTransformationMethod(theMethod);
    theReceiver = new TargetInvocationWhileInstantiatingMethodBasedProxyTest();
    valueHolder = new TransformerBasedValueHolder(theTransformer, theReceiver, row, (AbstractSession) getSession());
    expectedException = DescriptorException.targetInvocationWhileInstantiatingMethodBasedProxy(new Exception());
}
Also used : TransformerBasedValueHolder(org.eclipse.persistence.internal.indirection.TransformerBasedValueHolder) RelationalDescriptor(org.eclipse.persistence.descriptors.RelationalDescriptor) MethodBasedAttributeTransformer(org.eclipse.persistence.mappings.transformers.MethodBasedAttributeTransformer) DatabaseRecord(org.eclipse.persistence.sessions.DatabaseRecord) EclipseLinkException(org.eclipse.persistence.exceptions.EclipseLinkException) DescriptorException(org.eclipse.persistence.exceptions.DescriptorException) AbstractSession(org.eclipse.persistence.internal.sessions.AbstractSession)

Example 33 with AbstractSession

use of org.eclipse.persistence.internal.sessions.AbstractSession in project eclipselink by eclipse-ee4j.

the class SQLSelectStatement method appendFromClauseToWriter.

/**
 * Print the from clause.
 * This includes outer joins, these must be printed before the normal join to ensure that the source tables are not joined again.
 * Outer joins are not printed in the FROM clause on Oracle or Sybase.
 */
public void appendFromClauseToWriter(ExpressionSQLPrinter printer) throws IOException {
    Writer writer = printer.getWriter();
    AbstractSession session = printer.getSession();
    writer.write(" FROM ");
    // Print outer joins
    boolean firstTable = true;
    // Must keep track of tables used for outer join so no normal join is given
    List<DatabaseTable> outerJoinedAliases = new ArrayList<>(4);
    // prepare to lock tables if required
    boolean shouldPrintUpdateClause = printer.getPlatform().shouldPrintForUpdateClause() && !printer.getPlatform().shouldPrintLockingClauseAfterWhereClause() && (getForUpdateClause() != null);
    Collection aliasesOfTablesToBeLocked = null;
    boolean shouldPrintUpdateClauseForAllTables = false;
    if (shouldPrintUpdateClause) {
        aliasesOfTablesToBeLocked = getForUpdateClause().getAliasesOfTablesToBeLocked(this);
        shouldPrintUpdateClauseForAllTables = aliasesOfTablesToBeLocked.size() == getTableAliases().size();
    }
    if (hasOuterJoinExpressions()) {
        if (session.getPlatform().isInformixOuterJoin()) {
            appendFromClauseForInformixOuterJoin(printer, outerJoinedAliases);
        } else if (!session.getPlatform().shouldPrintOuterJoinInWhereClause() || !session.getPlatform().shouldPrintInnerJoinInWhereClause()) {
            appendFromClauseForOuterJoin(printer, outerJoinedAliases, aliasesOfTablesToBeLocked, shouldPrintUpdateClauseForAllTables);
        }
        firstTable = false;
    }
    // most likely the wrong builder was used, or wrong builder on the left in a sub-query.
    if (getTableAliases().isEmpty()) {
        // Query is set in execute.
        throw QueryException.invalidBuilderInQuery(null);
    }
    // Print tables for normal join
    for (DatabaseTable alias : getTableAliases().keySet()) {
        if (!outerJoinedAliases.contains(alias)) {
            DatabaseTable table = getTableAliases().get(alias);
            if (requiresAliases()) {
                if (!firstTable) {
                    writer.write(", ");
                }
                firstTable = false;
                table.printSQL(printer);
                writer.write(" ");
                if (alias.isDecorated()) {
                    ((DecoratedDatabaseTable) alias).getAsOfClause().printSQL(printer);
                    writer.write(" ");
                }
                alias.printSQL(printer);
            } else {
                table.printSQL(printer);
                if (alias.isDecorated()) {
                    writer.write(" ");
                    ((DecoratedDatabaseTable) alias).getAsOfClause().printSQL(printer);
                }
            }
            if (shouldPrintUpdateClause) {
                if (shouldPrintUpdateClauseForAllTables || aliasesOfTablesToBeLocked.remove(alias)) {
                    getForUpdateClause().printSQL(printer, this);
                }
            }
        }
    }
}
Also used : ArrayList(java.util.ArrayList) DecoratedDatabaseTable(org.eclipse.persistence.internal.history.DecoratedDatabaseTable) DatabaseTable(org.eclipse.persistence.internal.helper.DatabaseTable) Collection(java.util.Collection) CharArrayWriter(java.io.CharArrayWriter) Writer(java.io.Writer) AbstractSession(org.eclipse.persistence.internal.sessions.AbstractSession)

Example 34 with AbstractSession

use of org.eclipse.persistence.internal.sessions.AbstractSession in project eclipselink by eclipse-ee4j.

the class SQLSelectStatement method appendFromClauseForOuterJoin.

/**
 * ADVANCED:
 * Appends the SQL standard outer join clause, and some variation per platform.
 * Most platforms use this syntax, support is also offered for Oracle to join in the where clause (although it should use the FROM clause as the WHERE clause is obsolete).
 * This is also used for inner joins when configured in the platform.
 */
public void appendFromClauseForOuterJoin(ExpressionSQLPrinter printer, List<DatabaseTable> outerJoinedAliases, Collection aliasesOfTablesToBeLocked, boolean shouldPrintUpdateClauseForAllTables) throws IOException {
    Writer writer = printer.getWriter();
    AbstractSession session = printer.getSession();
    DatabasePlatform platform = session.getPlatform();
    // Print outer joins
    boolean firstTable = true;
    // Checks if the JDBC closing escape syntax is needed.
    boolean requiresEscape = false;
    boolean usesHistory = (getBuilder() != null) && getBuilder().hasAsOfClause();
    int nSize = getOuterJoinExpressionsHolders().size();
    for (OuterJoinExpressionHolder holder : getOuterJoinExpressionsHolders()) {
        holder.process(usesHistory);
    }
    if (nSize > 1) {
        sortOuterJoinExpressionHolders(getOuterJoinExpressionsHolders());
    }
    for (OuterJoinExpressionHolder holder : outerJoinExpressionHolders) {
        ObjectExpression outerExpression = holder.joinExpression;
        boolean isOuterJoin = (outerExpression == null) || outerExpression.shouldUseOuterJoin();
        DatabaseTable targetTable = holder.targetTable;
        DatabaseTable sourceTable = holder.sourceTable;
        DatabaseTable sourceAlias = holder.sourceAlias;
        DatabaseTable targetAlias = holder.targetAlias;
        if (!outerJoinedAliases.contains(targetAlias)) {
            if (!outerJoinedAliases.contains(sourceAlias)) {
                if (requiresEscape && session.getPlatform().shouldUseJDBCOuterJoinSyntax()) {
                    writer.write("}");
                }
                if (!firstTable) {
                    writer.write(",");
                }
                if (platform.shouldUseJDBCOuterJoinSyntax()) {
                    writer.write(platform.getJDBCOuterJoinString());
                }
                requiresEscape = true;
                firstTable = false;
                sourceTable.printSQL(printer);
                outerJoinedAliases.add(sourceAlias);
                writer.write(" ");
                if (sourceAlias.isDecorated()) {
                    ((DecoratedDatabaseTable) sourceAlias).getAsOfClause().printSQL(printer);
                    writer.write(" ");
                }
                sourceAlias.printSQL(printer);
                printForUpdateClauseOnJoin(sourceAlias, printer, shouldPrintUpdateClauseForAllTables, aliasesOfTablesToBeLocked, platform);
            }
            if (outerExpression == null) {
                holder.printAdditionalJoins(printer, outerJoinedAliases, aliasesOfTablesToBeLocked, shouldPrintUpdateClauseForAllTables);
            } else {
                DatabaseTable relationTable = outerExpression.getRelationTable();
                boolean hasAdditionalJoinExpressions = holder.hasAdditionalJoinExpressions();
                boolean isMapKeyObject = holder.hasMapKeyHolder();
                Expression additionalOnExpression = outerExpression.getOnClause();
                if (relationTable == null) {
                    if (outerExpression.isDirectCollection()) {
                        // Append the join clause,
                        // If this is a direct collection, join to direct table.
                        Expression onExpression = holder.outerJoinedMappingCriteria;
                        DatabaseTable newAlias = onExpression.aliasForTable(targetTable);
                        if (isOuterJoin) {
                            writer.write(" LEFT OUTER JOIN ");
                        } else {
                            writer.write(" JOIN ");
                        }
                        targetTable.printSQL(printer);
                        writer.write(" ");
                        if (newAlias.isDecorated()) {
                            ((DecoratedDatabaseTable) newAlias).getAsOfClause().printSQL(printer);
                            writer.write(" ");
                        }
                        outerJoinedAliases.add(newAlias);
                        newAlias.printSQL(printer);
                        printForUpdateClauseOnJoin(newAlias, printer, shouldPrintUpdateClauseForAllTables, aliasesOfTablesToBeLocked, platform);
                        printOnClause(onExpression.and(additionalOnExpression), printer, platform);
                    } else {
                        // the rest of the tables are joined with the additional join criteria.
                        if (isOuterJoin) {
                            writer.write(" LEFT OUTER JOIN ");
                        } else {
                            writer.write(" JOIN ");
                        }
                        if (hasAdditionalJoinExpressions && platform.supportsNestingOuterJoins()) {
                            writer.write("(");
                        }
                        targetTable.printSQL(printer);
                        writer.write(" ");
                        if (targetAlias.isDecorated()) {
                            ((DecoratedDatabaseTable) targetAlias).getAsOfClause().printSQL(printer);
                            writer.write(" ");
                        }
                        outerJoinedAliases.add(targetAlias);
                        targetAlias.printSQL(printer);
                        printForUpdateClauseOnJoin(targetAlias, printer, shouldPrintUpdateClauseForAllTables, aliasesOfTablesToBeLocked, platform);
                        if (hasAdditionalJoinExpressions && platform.supportsNestingOuterJoins()) {
                            holder.printAdditionalJoins(printer, outerJoinedAliases, aliasesOfTablesToBeLocked, shouldPrintUpdateClauseForAllTables);
                            writer.write(")");
                        }
                        Expression sourceToTargetJoin = holder.outerJoinedMappingCriteria;
                        if (additionalOnExpression != null) {
                            if (sourceToTargetJoin == null) {
                                sourceToTargetJoin = additionalOnExpression;
                            } else {
                                sourceToTargetJoin = sourceToTargetJoin.and(additionalOnExpression);
                            }
                        }
                        printOnClause(sourceToTargetJoin, printer, platform);
                        if (hasAdditionalJoinExpressions && !platform.supportsNestingOuterJoins()) {
                            holder.printAdditionalJoins(printer, outerJoinedAliases, aliasesOfTablesToBeLocked, shouldPrintUpdateClauseForAllTables);
                        }
                    }
                } else {
                    // Bug#4240751 Treat ManyToManyMapping separately for out join
                    // Must outer join each of the targets tables.
                    // The first table is joined with the mapping join criteria,
                    // the rest of the tables are joined with the additional join criteria.
                    // For example: EMPLOYEE t1 LEFT OUTER JOIN (PROJ_EMP t3 LEFT OUTER JOIN PROJECT t0 ON (t0.PROJ_ID = t3.PROJ_ID)) ON (t3.EMP_ID = t1.EMP_ID)
                    // Now OneToOneMapping also may have relation table.
                    DatabaseTable relationAlias = holder.outerJoinedMappingCriteria.aliasForTable(relationTable);
                    DatabaseTable mapKeyAlias = null;
                    DatabaseTable mapKeyTable = null;
                    List<DatabaseTable> tablesInOrder = new ArrayList<>();
                    // glassfish issue 2440: store aliases instead of tables
                    // in the tablesInOrder. This allows to distinguish source
                    // and target table in case of an self referencing relationship.
                    tablesInOrder.add(sourceAlias);
                    tablesInOrder.add(relationAlias);
                    tablesInOrder.add(targetAlias);
                    if (isMapKeyObject) {
                        // Need to also join the map key key.
                        mapKeyAlias = holder.mapKeyHolder.targetAlias;
                        mapKeyTable = holder.mapKeyHolder.targetTable;
                        tablesInOrder.add(mapKeyAlias);
                    }
                    TreeMap indexToExpressionMap = new TreeMap();
                    mapTableIndexToExpression(holder.outerJoinedMappingCriteria, indexToExpressionMap, tablesInOrder);
                    Expression sourceToRelationJoin = (Expression) indexToExpressionMap.get(1);
                    Expression relationToTargetJoin = (Expression) indexToExpressionMap.get(2);
                    Expression relationToKeyJoin = null;
                    if (isMapKeyObject) {
                        relationToKeyJoin = (Expression) indexToExpressionMap.get(3);
                    }
                    if (outerExpression.shouldUseOuterJoin()) {
                        writer.write(" LEFT OUTER JOIN ");
                    } else {
                        writer.write(" JOIN ");
                    }
                    if (platform.supportsNestingOuterJoins()) {
                        writer.write("(");
                    }
                    relationTable.printSQL(printer);
                    writer.write(" ");
                    if (relationAlias.isDecorated()) {
                        ((DecoratedDatabaseTable) relationAlias).getAsOfClause().printSQL(printer);
                        writer.write(" ");
                    }
                    outerJoinedAliases.add(relationAlias);
                    relationAlias.printSQL(printer);
                    printForUpdateClauseOnJoin(relationAlias, printer, shouldPrintUpdateClauseForAllTables, aliasesOfTablesToBeLocked, platform);
                    if (!platform.supportsNestingOuterJoins()) {
                        printOnClause(sourceToRelationJoin.and(additionalOnExpression), printer, platform);
                    }
                    if (isMapKeyObject) {
                        // Append join to map key.
                        if (isOuterJoin && !session.getPlatform().supportsANSIInnerJoinSyntax()) {
                            writer.write(" LEFT OUTER");
                        }
                        writer.write(" JOIN ");
                        mapKeyTable.printSQL(printer);
                        writer.write(" ");
                        if (mapKeyAlias.isDecorated()) {
                            ((DecoratedDatabaseTable) mapKeyAlias).getAsOfClause().printSQL(printer);
                            writer.write(" ");
                        }
                        outerJoinedAliases.add(mapKeyAlias);
                        mapKeyAlias.printSQL(printer);
                        printForUpdateClauseOnJoin(mapKeyAlias, printer, shouldPrintUpdateClauseForAllTables, aliasesOfTablesToBeLocked, platform);
                        printOnClause(relationToKeyJoin.and(additionalOnExpression), printer, platform);
                        if (holder.mapKeyHolder.hasAdditionalJoinExpressions()) {
                            holder.mapKeyHolder.printAdditionalJoins(printer, outerJoinedAliases, aliasesOfTablesToBeLocked, shouldPrintUpdateClauseForAllTables);
                        }
                    }
                    if (isOuterJoin && !session.getPlatform().supportsANSIInnerJoinSyntax()) {
                        // if the DB does not support 'JOIN', do a left outer
                        // join instead. This will give the same result because
                        // the left table is a join table and has therefore
                        // no rows that are not in the right table.
                        writer.write(" LEFT OUTER");
                    }
                    writer.write(" JOIN ");
                    targetTable.printSQL(printer);
                    writer.write(" ");
                    if (targetAlias.isDecorated()) {
                        ((DecoratedDatabaseTable) targetAlias).getAsOfClause().printSQL(printer);
                        writer.write(" ");
                    }
                    outerJoinedAliases.add(targetAlias);
                    targetAlias.printSQL(printer);
                    printForUpdateClauseOnJoin(targetAlias, printer, shouldPrintUpdateClauseForAllTables, aliasesOfTablesToBeLocked, platform);
                    printOnClause(relationToTargetJoin, printer, platform);
                    if (hasAdditionalJoinExpressions) {
                        holder.printAdditionalJoins(printer, outerJoinedAliases, aliasesOfTablesToBeLocked, shouldPrintUpdateClauseForAllTables);
                    }
                    if (platform.supportsNestingOuterJoins()) {
                        writer.write(")");
                        printOnClause(sourceToRelationJoin, printer, platform);
                    }
                }
            }
        }
    }
    if (requiresEscape && session.getPlatform().shouldUseJDBCOuterJoinSyntax()) {
        writer.write("}");
    }
}
Also used : Expression(org.eclipse.persistence.expressions.Expression) ArrayList(java.util.ArrayList) DecoratedDatabaseTable(org.eclipse.persistence.internal.history.DecoratedDatabaseTable) DatabaseTable(org.eclipse.persistence.internal.helper.DatabaseTable) DatabasePlatform(org.eclipse.persistence.internal.databaseaccess.DatabasePlatform) TreeMap(java.util.TreeMap) CharArrayWriter(java.io.CharArrayWriter) Writer(java.io.Writer) AbstractSession(org.eclipse.persistence.internal.sessions.AbstractSession)

Example 35 with AbstractSession

use of org.eclipse.persistence.internal.sessions.AbstractSession in project eclipselink by eclipse-ee4j.

the class AggregateObjectMapping method initialize.

/**
 * INTERNAL:
 * For an aggregate mapping the reference descriptor is cloned. The cloned descriptor is then
 * assigned primary keys and table names before initialize. Once the cloned descriptor is initialized
 * it is assigned as reference descriptor in the aggregate mapping. This is a very specific
 * behavior for aggregate mappings. The original descriptor is used only for creating clones and
 * after that the aggregate mapping never uses it.
 * Some initialization is done in postInitialize to ensure the target descriptor's references are initialized.
 */
@Override
public void initialize(AbstractSession session) throws DescriptorException {
    AbstractSession referenceSession = session;
    if (session.hasBroker()) {
        if (getReferenceClass() == null) {
            throw DescriptorException.referenceClassNotSpecified(this);
        }
        referenceSession = session.getSessionForClass(getReferenceClass());
    }
    super.initialize(session);
    ClassDescriptor clonedDescriptor = (ClassDescriptor) getReferenceDescriptor().clone();
    List<AttributeAccessor> accessorTree = getDescriptor().getAccessorTree();
    if (accessorTree == null) {
        accessorTree = new ArrayList();
    } else {
        accessorTree = new ArrayList<>(accessorTree);
    }
    accessorTree.add(getAttributeAccessor());
    clonedDescriptor.setAccessorTree(accessorTree);
    if (isMapKeyMapping() && clonedDescriptor.isAggregateDescriptor()) {
        clonedDescriptor.descriptorIsAggregateCollection();
    }
    if (clonedDescriptor.isChildDescriptor()) {
        ClassDescriptor parentDescriptor = session.getDescriptor(clonedDescriptor.getInheritancePolicy().getParentClass());
        initializeParentInheritance(parentDescriptor, clonedDescriptor, session);
    }
    setReferenceDescriptor(clonedDescriptor);
    // Apply any override m2m mappings to their cloned mappings.
    for (ManyToManyMapping overrideMapping : overrideManyToManyMappings) {
        DatabaseMapping mapping = clonedDescriptor.getMappingForAttributeName(overrideMapping.getAttributeName());
        if (mapping.isManyToManyMapping()) {
            ManyToManyMapping mappingClone = (ManyToManyMapping) mapping;
            mappingClone.setRelationTable(overrideMapping.getRelationTable());
            mappingClone.setSourceKeyFields(overrideMapping.getSourceKeyFields());
            mappingClone.setSourceRelationKeyFields(overrideMapping.getSourceRelationKeyFields());
            mappingClone.setTargetKeyFields(overrideMapping.getTargetKeyFields());
            mappingClone.setTargetRelationKeyFields(overrideMapping.getTargetRelationKeyFields());
        }
    // Else, silently ignored for now. These override mappings are set
    // and controlled through JPA metadata processing.
    }
    // Apply any override uni-directional 12m mappings to their cloned mappings.
    for (UnidirectionalOneToManyMapping overrideMapping : overrideUnidirectionalOneToManyMappings) {
        DatabaseMapping mapping = clonedDescriptor.getMappingForAttributeName(overrideMapping.getAttributeName());
        if (mapping.isUnidirectionalOneToManyMapping()) {
            UnidirectionalOneToManyMapping mappingClone = (UnidirectionalOneToManyMapping) mapping;
            mappingClone.setSourceKeyFields(overrideMapping.getSourceKeyFields());
            mappingClone.setTargetForeignKeyFields(overrideMapping.getTargetForeignKeyFields());
        }
    // Else, silently ignored for now. These override mappings are set
    // and controlled through JPA metadata processing.
    }
    // Mark any mapsId mappings as read-only.
    for (DatabaseMapping mapsIdMapping : mapsIdMappings) {
        DatabaseMapping mapping = clonedDescriptor.getMappingForAttributeName(mapsIdMapping.getAttributeName());
        if (mapping != null) {
            mapping.setIsReadOnly(true);
        }
    // Else, silently ignored for now. Maps id mappings are set and
    // controlled through JPA metadata processing.
    }
    // disallow null for aggregates with target foreign key relationships
    if (isNullAllowed) {
        if (getReferenceDescriptor().hasTargetForeignKeyMapping(session)) {
            isNullAllowed = false;
            session.log(SessionLog.WARNING, SessionLog.METADATA, "metadata_warning_ignore_is_null_allowed", new Object[] { this });
        }
    }
    initializeReferenceDescriptor(clonedDescriptor, referenceSession);
    // must translate before initializing because this mapping may have nested translations.
    translateNestedFields(clonedDescriptor, referenceSession);
    clonedDescriptor.preInitialize(referenceSession);
    clonedDescriptor.initialize(referenceSession);
    // so we can successfully traverse dot notation names)
    for (String attributeName : converters.keySet()) {
        String attr = attributeName;
        ClassDescriptor desc = clonedDescriptor;
        int idx;
        while ((idx = attr.indexOf('.')) > -1) {
            desc = desc.getMappingForAttributeName(attr.substring(0, idx)).getReferenceDescriptor();
            attr = attr.substring(idx + 1);
        }
        DatabaseMapping mapping = desc.getMappingForAttributeName(attr);
        if (mapping != null) {
            // Initialize and set the converter on the mapping.
            converters.get(attributeName).initialize(mapping, session);
        }
    // Else, silently ignored for now. These converters are set and
    // controlled through JPA metadata processing.
    }
    translateFields(clonedDescriptor, referenceSession);
    if (clonedDescriptor.hasInheritance() && clonedDescriptor.getInheritancePolicy().hasChildren()) {
        // clone child descriptors
        initializeChildInheritance(clonedDescriptor, referenceSession);
    }
    setFields(collectFields());
    // Add the nested pre delete mappings to the source entity.
    if (!isMapKeyMapping() && clonedDescriptor.hasPreDeleteMappings()) {
        getDescriptor().addPreDeleteMapping(this);
    }
}
Also used : ClassDescriptor(org.eclipse.persistence.descriptors.ClassDescriptor) ArrayList(java.util.ArrayList) AbstractSession(org.eclipse.persistence.internal.sessions.AbstractSession)

Aggregations

AbstractSession (org.eclipse.persistence.internal.sessions.AbstractSession)215 ClassDescriptor (org.eclipse.persistence.descriptors.ClassDescriptor)52 ContainerPolicy (org.eclipse.persistence.internal.queries.ContainerPolicy)28 ArrayList (java.util.ArrayList)26 AbstractRecord (org.eclipse.persistence.internal.sessions.AbstractRecord)26 Vector (java.util.Vector)22 DatabaseField (org.eclipse.persistence.internal.helper.DatabaseField)22 DatabaseMapping (org.eclipse.persistence.mappings.DatabaseMapping)21 EntityManager (jakarta.persistence.EntityManager)19 List (java.util.List)18 Session (org.eclipse.persistence.sessions.Session)18 JpaEntityManager (org.eclipse.persistence.jpa.JpaEntityManager)15 InvalidObject (org.eclipse.persistence.internal.helper.InvalidObject)14 UnitOfWorkImpl (org.eclipse.persistence.internal.sessions.UnitOfWorkImpl)14 HashMap (java.util.HashMap)12 Map (java.util.Map)12 Collection (java.util.Collection)11 DatabaseQuery (org.eclipse.persistence.queries.DatabaseQuery)11 SQLException (java.sql.SQLException)10 DatabaseException (org.eclipse.persistence.exceptions.DatabaseException)9