Search in sources :

Example 56 with UpdateAllQuery

use of org.eclipse.persistence.queries.UpdateAllQuery in project eclipselink by eclipse-ee4j.

the class UpdateAllQueryAdvancedJunitTest method testAssignObjectToAddress.

public static void testAssignObjectToAddress() {
    Address address = new Address();
    address.setCountry("Canada");
    address.setProvince("Ontario");
    address.setCity("Ottawa");
    address.setStreet("O'Connor");
    UnitOfWork uow = acquireUnitOfWork();
    uow.registerNewObject(address);
    uow.commit();
    UpdateAllQuery updateQuery = new UpdateAllQuery(Employee.class);
    updateQuery.addUpdate("address", address);
    updateAllQueryInternal(updateQuery);
}
Also used : UnitOfWork(org.eclipse.persistence.sessions.UnitOfWork) UpdateAllQuery(org.eclipse.persistence.queries.UpdateAllQuery)

Example 57 with UpdateAllQuery

use of org.eclipse.persistence.queries.UpdateAllQuery in project eclipselink by eclipse-ee4j.

the class UpdateNode method createDatabaseQuery.

/**
 * INTERNAL
 * Returns a DatabaseQuery instance representing the owning
 * ParseTree. This implementation returns a UpdateAllQuery instance.
 */
@Override
public DatabaseQuery createDatabaseQuery(ParseTreeContext context) {
    UpdateAllQuery query = new UpdateAllQuery();
    query.setShouldDeferExecutionInUOW(false);
    return query;
}
Also used : UpdateAllQuery(org.eclipse.persistence.queries.UpdateAllQuery)

Aggregations

UpdateAllQuery (org.eclipse.persistence.queries.UpdateAllQuery)57 ExpressionBuilder (org.eclipse.persistence.expressions.ExpressionBuilder)36 UnitOfWork (org.eclipse.persistence.sessions.UnitOfWork)22 Expression (org.eclipse.persistence.expressions.Expression)19 EntityManager (jakarta.persistence.EntityManager)13 DeleteAllQuery (org.eclipse.persistence.queries.DeleteAllQuery)12 ReportQuery (org.eclipse.persistence.queries.ReportQuery)10 ArrayList (java.util.ArrayList)9 List (java.util.List)9 Vector (java.util.Vector)9 ReadAllQuery (org.eclipse.persistence.queries.ReadAllQuery)8 Iterator (java.util.Iterator)7 HashMap (java.util.HashMap)5 Map (java.util.Map)4 IdentityHashMap (java.util.IdentityHashMap)3 DataExpression (org.eclipse.persistence.internal.expressions.DataExpression)3 ExpressionIterator (org.eclipse.persistence.internal.expressions.ExpressionIterator)3 DatabaseField (org.eclipse.persistence.internal.helper.DatabaseField)3 ConstantExpression (org.eclipse.persistence.internal.expressions.ConstantExpression)2 FieldExpression (org.eclipse.persistence.internal.expressions.FieldExpression)2