Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 366199 - CriteriaBuilder.tuple(Selection) does not throw IllegalArgumentException if an argument is a tuple- or array-valued selection item
Summary: CriteriaBuilder.tuple(Selection) does not throw IllegalArgumentException if a...
Status: CLOSED DUPLICATE of bug 366100
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 blocker (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-09 09:59 EST by Stephen DiMilla CLA
Modified: 2022-06-09 10:25 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stephen DiMilla CLA 2011-12-09 09:59:59 EST
Build Identifier: eclipselink-2.3.0.v20110604-r9504

Using the entity:

@Entity
@Table(name="CUSTOMER_TABLE")
public class Customer implements java.io.Serializable
{

    // Instance variables
    private String id;
    private String name;
    public Customer()
    {
    }

    public Customer (String id, String name)
    {
    this.id = id;
    this.name = name;
    }
   @Id
    @Column(name="ID")
    public String getId() {
    return id;
    }
    public void setId(String v) {
    this.id = v;
    }

    @Column(name="NAME")
    public String getName() {
    return name;
    }
    public void setName(String v) {
    this.name = v;
    }
}
----------------------
Using the client code:

        CriteriaBuilder qbuilder = em.getCriteriaBuilder();
        et.begin();
        
        CriteriaQuery<Tuple> cquery = qbuilder.createTupleQuery();
        Root<Customer> cust = cquery.from(Customer.class);

        EntityType<Customer> Customer_ = cust.getModel();

        Selection[] s = {cust.get("id"), cust.get("name")};

        System.out.println("Testing tuple");
        try {
            qbuilder.tuple(qbuilder.tuple(s));
            System.out.println("Did not throw IllegalArgumentException");
        } catch (IllegalArgumentException iae) {
            System.out.println("Received expected IllegalArgumentException");
        } catch (Exception e) {
            System.out.println("Received unexpected exception", e);
        }

        System.out.println("Testing array");
        try {
            qbuilder.tuple(qbuilder.array(s));
            System.out.println("Did not throw IllegalArgumentException");
        } catch (IllegalArgumentException iae) {
            System.out.println("Received expected IllegalArgumentException");
        } catch (Exception e) {
            System.out.println("Received unexpected exception", e);
        }


        et.commit();

Reproducible: Always
Comment 1 Stephen DiMilla CLA 2011-12-09 10:03:14 EST
output:

Testing tuple
Did not throw IllegalArgumentException
Testing array
Did not throw IllegalArgumentException
Comment 2 Tom Ware CLA 2012-04-05 11:01:21 EDT
Updating target milestone.
Comment 3 Chris Delahunt CLA 2012-11-08 11:36:52 EST
the patch for 366100 will fix this issue as well

*** This bug has been marked as a duplicate of bug 366100 ***
Comment 4 Eclipse Webmaster CLA 2022-06-09 10:16:48 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink
Comment 5 Eclipse Webmaster CLA 2022-06-09 10:25:01 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink