Bug 506714 - EclipseLink create temporary table wrong column types for CriteriaUpdate (mysql)
Summary: EclipseLink create temporary table wrong column types for CriteriaUpdate (mysql)
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows NT
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-10-28 10:35 EDT by Dave Tiger CLA
Modified: 2022-06-09 10:05 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dave Tiger CLA 2016-10-28 10:35:06 EDT
EclipseLink create temporary table wrong column types for CriteriaUpdate.
DB: MySQL.

For example, Product

    id            name          price
    ------------------------------------------
    bigint(20)    varchar(30)   decimal(19,2)


Set product price:

		CriteriaBuilder criteriaBuilder = em.getCriteriaBuilder();
		CriteriaUpdate<Product> criteriaUpdate = criteriaBuilder.createCriteriaUpdate(Product.class);
		Root<Product> root = criteriaUpdate.from(Product.class);
        criteriaUpdate.set(root.get("price"), 6.05);
        em.createQuery(criteriaUpdate).executeUpdate();

A temporary table will be created for updateALL, and the price column type is  decimal(37), not consistent with decimal(19,2).  As a result, For example, 6.05 will become 6.  Is this a bug?

https://dev.eclipse.org/mhonarc/lists/eclipselink-users/msg04987.html

    If you never use this case you can override in MySQLPlatform:
    public boolean shouldAlwaysUseTempStorageForModifyAll() {
        return false;
    }
    and will get the same behavior in UpdateAll/DeleteAll as on other database platforms..

Do I need to change EclipseLink source code for this? is there a way to
configure it in persistence.xml?

Thanks.
Comment 1 Eclipse Webmaster CLA 2022-06-09 10:05:33 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink