Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[master] Jakarta Persistence 3.2 new feature - JPQL UNION, INTERSECT, EXCEPT, CAST #1937

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2023 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2015 SAP. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -187,7 +187,7 @@ public void testNegativ() {
boolean operationFailed = false;
env.beginTransaction(em);
try {
employee = em.getReference(Employee.class, 17 + 4);
employee = em.getReference(Employee.class, 741);
} catch (EntityNotFoundException e) {
// $JL-EXC$ expected behavior
operationFailed = true;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2023 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 v. 2.0 which is available at
Expand All @@ -16,9 +16,7 @@
package org.eclipse.persistence.jpa.jpql;

import org.eclipse.persistence.jpa.jpql.parser.AsOfClause;
import org.eclipse.persistence.jpa.jpql.parser.CastExpression;
import org.eclipse.persistence.jpa.jpql.parser.ConnectByClause;
import org.eclipse.persistence.jpa.jpql.parser.DatabaseType;
import org.eclipse.persistence.jpa.jpql.parser.EclipseLinkExpressionVisitor;
import org.eclipse.persistence.jpa.jpql.parser.Expression;
import org.eclipse.persistence.jpa.jpql.parser.ExtractExpression;
Expand All @@ -28,7 +26,6 @@
import org.eclipse.persistence.jpa.jpql.parser.StartWithClause;
import org.eclipse.persistence.jpa.jpql.parser.TableExpression;
import org.eclipse.persistence.jpa.jpql.parser.TableVariableDeclaration;
import org.eclipse.persistence.jpa.jpql.parser.UnionClause;

/**
* This visitor calculates the type of an input parameter.
Expand Down Expand Up @@ -57,21 +54,11 @@ public void visit(AsOfClause expression) {
type = Object.class;
}

@Override
public void visit(CastExpression expression) {
type = Object.class;
}

@Override
public void visit(ConnectByClause expression) {
type = Object.class;
}

@Override
public void visit(DatabaseType expression) {
type = Object.class;
}

@Override
public void visit(ExtractExpression expression) {
type = Object.class;
Expand Down Expand Up @@ -115,9 +102,4 @@ public void visit(TableExpression expression) {
public void visit(TableVariableDeclaration expression) {
type = Object.class;
}

@Override
public void visit(UnionClause expression) {
type = Object.class;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2006, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 2023 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 v. 2.0 which is available at
Expand All @@ -19,7 +19,6 @@
import org.eclipse.persistence.jpa.jpql.parser.AnonymousExpressionVisitor;
import org.eclipse.persistence.jpa.jpql.parser.AsOfClause;
import org.eclipse.persistence.jpa.jpql.parser.BadExpression;
import org.eclipse.persistence.jpa.jpql.parser.CastExpression;
import org.eclipse.persistence.jpa.jpql.parser.CollectionExpression;
import org.eclipse.persistence.jpa.jpql.parser.CollectionValuedPathExpression;
import org.eclipse.persistence.jpa.jpql.parser.ConnectByClause;
Expand All @@ -40,7 +39,6 @@
import org.eclipse.persistence.jpa.jpql.parser.StateFieldPathExpression;
import org.eclipse.persistence.jpa.jpql.parser.TableExpression;
import org.eclipse.persistence.jpa.jpql.parser.TableVariableDeclaration;
import org.eclipse.persistence.jpa.jpql.parser.UnionClause;

import static org.eclipse.persistence.jpa.jpql.JPQLQueryProblemMessages.*;

Expand Down Expand Up @@ -109,11 +107,6 @@ protected LiteralVisitor buildLiteralVisitor() {
return new EclipseLinkLiteralVisitor();
}

@Override
protected OwningClauseVisitor buildOwningClauseVisitor() {
return new EclipseLinkOwningClauseVisitor();
}

protected SubquerySelectItemCalculator buildSubquerySelectItemCalculator() {
return new SubquerySelectItemCalculator();
}
Expand Down Expand Up @@ -391,12 +384,6 @@ public void visit(AsOfClause expression) {
// Nothing to validate semantically
}

@Override
public void visit(CastExpression expression) {
super.visit(expression);
// Nothing to validate semantically
}

@Override
public void visit(ConnectByClause expression) {
super.visit(expression);
Expand Down Expand Up @@ -464,38 +451,6 @@ public void visit(TableVariableDeclaration expression) {
// Nothing to validate semantically
}

@Override
public void visit(UnionClause expression) {
super.visit(expression);
// Nothing to validate semantically
}

// Made static final for performance reasons.
/**
* This visitor retrieves the clause owning the visited {@link Expression}.
*/
public static final class EclipseLinkOwningClauseVisitor extends OwningClauseVisitor {

public UnionClause unionClause;

/**
* Creates a new <code>EclipseLinkOwningClauseVisitor</code>.
*/
public EclipseLinkOwningClauseVisitor() {
super();
}

@Override
public void dispose() {
super.dispose();
unionClause = null;
}

public void visit(UnionClause expression) {
this.unionClause = expression;
}
}

// Made static final for performance reasons.
protected static final class SubquerySelectItemCalculator extends AnonymousExpressionVisitor {

Expand Down
Loading
Loading